-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: updates to fix build/package & produce binaries #12284
Merged
Merged
Changes from 56 commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
44a3438
chore: cache sample
awsluja 8e4712e
chore: update sample cache
awsluja a6901af
chore: test
awsluja a077dae
chore: test artifacts
awsluja 42b3dc7
chore: rename file
awsluja c0b222d
ci: testing s3 bucket
8c7842c
chore: fix build issue
432ec03
ci: implement caching solution
9f90025
ci: test
dba365c
ci: fix config
692ce51
ci: try another way to run buildlinux
0f33686
ci: fix path
aeb738c
ci: fix source
35a1bbe
ci: fix sh file header
8d9e144
ci: switch source to dot
ec65b42
ci: remove use of local
1b9d58f
ci: update s3 pathing
e475ee7
ci: remove function
986406b
ci: try again
cbf6afa
ci: specify bash
d2761c0
ci: bash test
bffdbfa
ci: remove parenthesis
f3f7981
ci: updated the cache to load
f34788b
ci: fix
0ce3ce5
ci: mute cache
68a8019
ci: fix
1b2703c
ci: update cache
450f132
ci: cleanup
5165c16
ci: add cache file method, graph updates
2a47d62
ci: graph updates
4e3ea7b
ci: rune2e sample
707d782
ci: yml fix
c45c509
ci: fix
4afa772
ci: fix
5ce53e0
ci: fix
4e63f65
ci: add validate
f81bd31
ci: fix
45a8eb5
ci: fix file names
503aeb9
ci: fix publish
9e2e16b
ci: test
5c91613
ci: fix pwd
a8c7b3d
ci: fix
a90d802
ci: fix
52c0be1
ci: test branch name
awsluja 8402e59
ci: test branch
awsluja 191870e
ci: test branch env var
awsluja 4bdcfbf
ci: test with updated vars
awsluja f0ec504
ci: test env var
awsluja 4dae2dc
ci: test env var
awsluja 1dfa6ff
ci: re-enable and test
awsluja cd2a0c9
ci: try something else for publish
awsluja 295a585
ci: test
awsluja b054d30
ci: try without caching verdaccio
awsluja 28c8373
ci: try new path to verdaccio cache
awsluja 9c36273
ci: disable sourcing invalid bash_env
awsluja 3ef460c
ci: move env vars into correct file
awsluja 147589d
Merge branch 'cb' into aluja/cb
aws-eddy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,119 @@ | ||
#!/bin/bash -e | ||
|
||
# lerna has a bug (https://github.com/lerna/lerna/issues/1066) where failed publishes do not set the exit code properly | ||
# this causes the script to keep running even after failed publishes | ||
# this function forces failed publishes to exit on failure | ||
function lernaPublishExitOnFailure { | ||
# exit on failure | ||
set -e | ||
# run lerna publish with the args that were passed to this function | ||
# duplicate stdout to a temp file | ||
# grep the temp file for the lerna err token and return exit 1 if found (-v option inverts grep exit code) | ||
npx lerna publish "$@" | tee /tmp/publish-results && grep -qvz "lerna ERR!" < /tmp/publish-results | ||
} | ||
|
||
if [ -z "$GITHUB_EMAIL" ]; then | ||
if [[ "$LOCAL_PUBLISH_TO_LATEST" == "true" ]]; then | ||
git config --global user.email not@used.com | ||
else | ||
echo "GITHUB_EMAIL email is missing" | ||
exit 1 | ||
fi | ||
else | ||
git config --global user.email $GITHUB_EMAIL | ||
fi | ||
|
||
if [ -z "$GITHUB_USER" ]; then | ||
if [[ "$LOCAL_PUBLISH_TO_LATEST" == "true" ]]; then | ||
git config --global user.name "Doesnt Matter" | ||
else | ||
echo "GITHUB_USER email is missing" | ||
exit 1 | ||
fi | ||
else | ||
git config --global user.name $GITHUB_USER | ||
fi | ||
|
||
if [[ "$CIRCLE_BRANCH" =~ ^tagged-release ]]; then | ||
if [[ "$CIRCLE_BRANCH" =~ ^tagged-release-without-e2e-tests\/.* ]]; then | ||
# Remove tagged-release-without-e2e-tests/ | ||
export NPM_TAG="${CIRCLE_BRANCH/tagged-release-without-e2e-tests\//}" | ||
elif [[ "$CIRCLE_BRANCH" =~ ^tagged-release\/.* ]]; then | ||
# Remove tagged-release/ | ||
export NPM_TAG="${CIRCLE_BRANCH/tagged-release\//}" | ||
fi | ||
if [ -z "$NPM_TAG" ]; then | ||
echo "Tag name is missing. Name your branch with either tagged-release/<tag-name> or tagged-release-without-e2e-tests/<tag-name>" | ||
exit 1 | ||
fi | ||
|
||
if [[ "$LOCAL_PUBLISH_TO_LATEST" == "true" ]]; then | ||
echo "Publishing to local registry under latest tag" | ||
lernaPublishExitOnFailure --exact --preid=$NPM_TAG --conventional-commits --conventional-prerelease --no-push --yes --include-merged-tags | ||
else | ||
echo "Publishing to NPM under $NPM_TAG tag" | ||
lernaPublishExitOnFailure --exact --dist-tag=$NPM_TAG --preid=$NPM_TAG --conventional-commits --conventional-prerelease --message "chore(release): Publish tagged release $NPM_TAG [ci skip]" --yes --include-merged-tags | ||
fi | ||
|
||
# @latest release | ||
elif [[ "$CIRCLE_BRANCH" == "release" ]]; then | ||
# create release commit and release tags | ||
npx lerna version --exact --conventional-commits --conventional-graduate --yes --no-push --include-merged-tags --message "chore(release): Publish latest [ci skip]" | ||
|
||
# publish versions that were just computed | ||
lernaPublishExitOnFailure from-git --yes --no-push | ||
|
||
if [[ "$LOCAL_PUBLISH_TO_LATEST" == "true" ]]; then | ||
echo "Published packages to verdaccio" | ||
echo "Exiting without pushing release commit or release tags" | ||
exit 0 | ||
fi | ||
|
||
# push release commit | ||
git push origin "$CIRCLE_BRANCH" | ||
|
||
# push release tags | ||
git tag --points-at HEAD | xargs git push origin | ||
|
||
# fast forward main to release | ||
git fetch origin main | ||
git checkout main | ||
git merge release --ff-only | ||
git push origin main | ||
|
||
# fast forward hotfix to release | ||
git fetch origin hotfix | ||
git checkout hotfix | ||
git merge release --ff-only | ||
git push origin hotfix | ||
|
||
# release candidate or local publish for testing / building binary | ||
elif [[ "$CIRCLE_BRANCH" =~ ^run-e2e-with-rc\/.* ]] || [[ "$CIRCLE_BRANCH" =~ ^release_rc\/.* ]] || [[ "$LOCAL_PUBLISH_TO_LATEST" == "true" ]]; then | ||
|
||
# force @aws-amplify/cli-internal to be versioned in case this pipeline run does not have any commits that modify the CLI packages | ||
if [[ "$LOCAL_PUBLISH_TO_LATEST" == "true" ]]; then | ||
force_publish_local_args="--force-publish '@aws-amplify/cli-internal'" | ||
fi | ||
# create release commit and release tags | ||
git checkout "${CODEBUILD_WEBHOOK_TRIGGER#branch/*}" && npx lerna version --preid=rc.$CODEBUILD_RESOLVED_SOURCE_VERSION --exact --conventional-prerelease --conventional-commits --yes --no-push --include-merged-tags --message "chore(release): Publish rc [ci skip]" $(echo $force_publish_local_args) --no-commit-hooks | ||
|
||
# if publishing locally to verdaccio | ||
if [[ "$LOCAL_PUBLISH_TO_LATEST" == "true" ]]; then | ||
# publish to verdaccio with no dist tag (default to latest) | ||
lernaPublishExitOnFailure from-package --git-head $CODEBUILD_RESOLVED_SOURCE_VERSION --yes --no-push | ||
echo "Published packages to verdaccio" | ||
echo "Exiting without pushing release commit or release tags" | ||
exit 0 | ||
fi | ||
|
||
# publish versions that were just computed | ||
lernaPublishExitOnFailure from-package --git-head $CODEBUILD_RESOLVED_SOURCE_VERSION --yes --no-push --dist-tag rc | ||
|
||
# push release commit | ||
git push origin "${CODEBUILD_WEBHOOK_TRIGGER#branch/*}" | ||
|
||
# push release tags | ||
git tag --points-at HEAD | xargs git push origin | ||
else | ||
echo "branch name" "${CODEBUILD_WEBHOOK_TRIGGER#branch/*}" "did not match any branch publish rules. Skipping publish" | ||
fi |
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,70 @@ | ||
version: 0.2 | ||
env: | ||
shell: bash | ||
compute-type: BUILD_GENERAL1_MEDIUM | ||
imagePullCredentialsType: SERVICE_ROLE | ||
variables: | ||
CLI_REGION: us-east-1 | ||
TEST_SUITE: src/__tests__/auth_2b.test.ts | ||
AMPLIFY_DIR: '$CODEBUILD_SRC_DIR/out' | ||
AMPLIFY_PATH: '$CODEBUILD_SRC_DIR/out/amplify-pkg-linux-x64' | ||
# secrets-manager: | ||
# S3_ACCESS_KEY: "secretname" # s3_access_key in secret manager | ||
|
||
batch: | ||
fast-fail: true | ||
build-graph: | ||
- identifier: build_linux | ||
buildspec: codebuild_specs/build_linux.yml | ||
debug-session: true | ||
env: | ||
compute-type: BUILD_GENERAL1_LARGE | ||
variables: | ||
IS_AMPLIFY_CI: true | ||
- identifier: test | ||
buildspec: codebuild_specs/test.yml | ||
debug-session: true | ||
env: | ||
compute-type: BUILD_GENERAL1_LARGE | ||
variables: | ||
EXAMPLE_SAMPLE: 'test' | ||
depend-on: | ||
- build_linux | ||
- identifier: validate_cdk_version | ||
buildspec: codebuild_specs/validate_cdk_version.yml | ||
debug-session: true | ||
depend-on: | ||
- build_linux | ||
- identifier: verify_api_extract | ||
buildspec: codebuild_specs/verify_api_extract.yml | ||
debug-session: true | ||
env: | ||
compute-type: BUILD_GENERAL1_LARGE | ||
depend-on: | ||
- build_linux | ||
- identifier: verify_yarn_lock | ||
buildspec: codebuild_specs/verify_yarn_lock.yml | ||
debug-session: true | ||
depend-on: | ||
- build_linux | ||
- identifier: publish_to_local_registry | ||
buildspec: codebuild_specs/publish_to_local_registry.yml | ||
debug-session: true | ||
env: | ||
compute-type: BUILD_GENERAL1_LARGE | ||
depend-on: | ||
- build_linux | ||
- identifier: build_pkg_binaries_linux | ||
buildspec: codebuild_specs/build_pkg_binaries_linux.yml | ||
debug-session: true | ||
env: | ||
compute-type: BUILD_GENERAL1_LARGE | ||
depend-on: | ||
- publish_to_local_registry | ||
- identifier: run_e2e_tests | ||
buildspec: codebuild_specs/run_e2e_tests.yml | ||
debug-session: true | ||
env: | ||
compute-type: BUILD_GENERAL1_LARGE | ||
depend-on: | ||
- build_pkg_binaries_linux |
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,11 @@ | ||
version: 0.2 | ||
env: | ||
shell: bash | ||
phases: | ||
build: | ||
commands: | ||
- source ./shared-scripts.sh && _buildLinux | ||
|
||
artifacts: | ||
files: | ||
- 'shared-scripts.sh' |
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,11 @@ | ||
version: 0.2 | ||
env: | ||
shell: bash | ||
phases: | ||
build: | ||
commands: | ||
- source ./shared-scripts.sh && _buildBinaries | ||
|
||
artifacts: | ||
files: | ||
- 'shared-scripts.sh' | ||
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,7 @@ | ||
version: 0.2 | ||
env: | ||
shell: bash | ||
phases: | ||
build: | ||
commands: | ||
- echo cleanup running |
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,7 @@ | ||
version: 0.2 | ||
env: | ||
shell: bash | ||
phases: | ||
build: | ||
commands: | ||
- echo integration testing |
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,7 @@ | ||
version: 0.2 | ||
env: | ||
shell: bash | ||
phases: | ||
build: | ||
commands: | ||
- source ./shared-scripts.sh && _lint |
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,7 @@ | ||
version: 0.2 | ||
env: | ||
shell: bash | ||
phases: | ||
build: | ||
commands: | ||
- source ./shared-scripts.sh && _mockE2ETests |
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,11 @@ | ||
version: 0.2 | ||
env: | ||
shell: bash | ||
phases: | ||
build: | ||
commands: | ||
- source ./shared-scripts.sh && _publishToLocalRegistry | ||
|
||
artifacts: | ||
files: | ||
- 'shared-scripts.sh' |
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,14 @@ | ||
version: 0.2 | ||
env: | ||
shell: bash | ||
variables: | ||
CLI_REGION: us-east-1 | ||
TEST_SUITE: src/__tests__/auth_2b.test.ts | ||
AMPLIFY_DIR: $CODEBUILD_SRC_DIR/out | ||
AMPLIFY_PATH: $CODEBUILD_SRC_DIR/out/amplify-pkg-linux-x64 | ||
phases: | ||
build: | ||
commands: | ||
- echo $AMPLIFY_DIR | ||
- echo $AMPLIFY_PATH | ||
- source ./shared-scripts.sh && _runE2ETestsLinux |
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,7 @@ | ||
version: 0.2 | ||
env: | ||
shell: bash | ||
phases: | ||
build: | ||
commands: | ||
- source ./shared-scripts.sh && _testLinux |
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,7 @@ | ||
version: 0.2 | ||
env: | ||
shell: bash | ||
phases: | ||
build: | ||
commands: | ||
- source ./shared-scripts.sh && _validateCDKVersion |
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,7 @@ | ||
version: 0.2 | ||
env: | ||
shell: bash | ||
phases: | ||
build: | ||
commands: | ||
- source ./shared-scripts.sh && _verifyAPIExtract |
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,7 @@ | ||
version: 0.2 | ||
env: | ||
shell: bash | ||
phases: | ||
build: | ||
commands: | ||
- source ./shared-scripts.sh && _verifyYarnLock |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this. Will test on my end