-
Notifications
You must be signed in to change notification settings - Fork 425
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add buildspec for environment pipelines (#3717)
Related #3522 By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.
- Loading branch information
1 parent
e561172
commit 14c6621
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Buildspec runs in the build stage of your environment pipeline to generate the environment CloudFormation stack config. | ||
version: 0.2 | ||
phases: | ||
install: | ||
runtime-versions: | ||
ruby: 2.6 | ||
commands: | ||
- echo "cd into $CODEBUILD_SRC_DIR" | ||
- cd $CODEBUILD_SRC_DIR | ||
# Download the copilot linux binary. You can update this version. | ||
- wget -q {{.BinaryS3BucketPath}}/copilot-linux-{{.Version}} | ||
- mv ./copilot-linux-{{.Version}} ./copilot-linux | ||
- chmod +x ./copilot-linux | ||
build: | ||
commands: | ||
- echo "Run your tests" | ||
# - make test | ||
post_build: | ||
commands: | ||
- ls -l | ||
- export COLOR="false" | ||
- export CI="true" | ||
- pipeline=$(cat $CODEBUILD_SRC_DIR/{{.ManifestPath}} | ruby -ryaml -rjson -e 'puts JSON.pretty_generate(YAML.load(ARGF))') | ||
- stages=$(echo $pipeline | jq -r '.stages[].name') | ||
# Generate the cloudformation templates. | ||
- > | ||
for env in $stages; do | ||
./copilot-linux env package -n $env --output-dir './infrastructure' --upload-assets; | ||
if [ $? -ne 0 ]; then | ||
echo "Cloudformation stack and config files were not generated. Please check build logs to see if there was a manifest validation error." 1>&2; | ||
exit 1; | ||
fi | ||
done; | ||
- ls -lah ./infrastructure | ||
artifacts: | ||
files: | ||
- "infrastructure/*" |