AWS CodeBuild pipeline CodeCommit git repo path - amazon-web-services

If I configure a CodeBuild pipleline as using the CodeCommit Source provider, what is the path of the source code (git repo) to refer to in the buildspec.yml commands?

Use the predefined environment variable "CODEBUILD_SRC_DIR". Details: https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html

Related

AWS CodeCommit does support Git LFS?

I have existing project repo in gitlab. Since the gitlab is running in the server, we have the lfs objects in certain directory. My Doubt is AWS Codecommit does not have seperate server to store any lfs configurations as gitlab or bitbucket. I've to configure the lfs directory in AWS CodeCommit. My Question is "Does AWS CodeCommit supports Git LFS?". If yes,can someone explain how to configure AWS CodeCommit with Git LFS?

Does CodeBuild only uses "Source" for grabbing buildspec if CodePipeline is configured to run the build job?

In my CodeBuild job config, source is connected to my BitBucket.
In my CodePipeline config, source is connected to my BitBucket through CodeStar (Full Clone perms).
I am using CodePipeline to use this build job in my Build stage so I'm under the assumption that CodeBuild build job would no longer need the source stage to be configured since CodePipeline is using source connection itself.
Is the source config in CodeBuild only to grab the buildspec file? (Since CodeBuild requires you to not put a buildspec file name if there is no source (even though WE know that there IS a source through CodePipeline).

Does AWS CodePipeline Project support GitSubmodulesConfig

CodeBuild supports initializing submodules. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-gitsubmodulesconfig.html
Is there similar support for Git Submodules in CodePipeline?
We do use a buildspec.yml file. Is there a way I can leverage "GitSubmodulesConfig" in the buildspec file?

How to access Multi-level repo in aws codebuild

I have the following repo structure in AWS code commit.
I have MainRepo folder and inside it has 2 sub-folder inside which respective solution and buildspec.yml file present.
I am trying to build proj1.sln using aws codebuild service.
In Source section of aws codebuild, it allows to select MainRepo only.
How can i select sub-folder Repo1 in aws codebuild?
You should create a new CodeCommit Repository first and create the CodeBuild Project from there.
You can follow the steps as below :
Create a new CodeCommit Repository and copy the repository URL from the CodeCommit console.
Clone the CodeCommit Repository from inside your <MainRepo> directory in the local computer (here I am guessing you have the MainRepo directory in your local machine, if not then you can clone it to your local machine)
You will have a new repo directory (eg. <Repo3>) on your local system inside <MainRepo> directory.
Copy the .git folder from <Repo3\.git> to <Repo1\.git> and you can git push your files from <Repo1> to the CodeCommit Repository.
Then you can build your Artifacts/CodeBuild Projects from the newly created CodeCommit Repository.

alternate appspec.yml location for AWS CodePipeline/CodeDeploy

i'm learning AWS-based continuous integration and have a basic CodeCommit → CodePipeline → CodeDeploy workflow setup per the tutorial. when i push to CodeCommit, CodePipeline triggers a build in CodeDeploy, however it does not find my appspec.yml manifest because it's not in the root of my repository.
how do i configure CodePipeline/CodeDeploy to look for appspec.yml under the subdirectory inst/aws/ instead of the repository root? i don't want to restructure my repo (which also has non-AWS content) just to accommodate a vendor-specific preference.
By default CodeDeploy agent looks at the root of your bundle for appspec.yml. Unfortunately you can't configure the location of the appspec.
You can do that with the use of AppSpecTemplatePath.
The file name of the AppSpec file stored in the pipeline source file
location, such as your pipeline's CodeCommit repository. The default
file name is appspec.yaml. If your AppSpec file has the same name and
is stored at the root level in your file repository, you do not need
to provide the file name. If the path is not the default, enter the
path and file name.
Source: https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-ECSbluegreen.html#action-reference-ECSbluegreen-type