-
Notifications
You must be signed in to change notification settings - Fork 45
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
chore(ci): Create docker images for commits in cd/staging
#1090
Merged
placer14
merged 4 commits into
master
from
mg/chore/create-docker-image-for-dev-release
Nov 16, 2022
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b9da479
chore(ci): Trigger docker build for branch cd/staging
placer14 78bcbe0
chore(ci): Cleanup unused jobs
placer14 b8ac585
chore(ci): Add timestamp to image tag to order for latest
placer14 8996486
fix(ci): Stricter token matching on cd/staging
placer14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,40 +35,6 @@ commands: | |
- run: git submodule sync | ||
- run: sudo apt-get install gcc libc-dev | ||
- run: git submodule update --init | ||
trigger-deployment: | ||
steps: | ||
- checkout | ||
- run: | ||
name: Trigger deployment for filecoin-project/lily | ||
command: | | ||
# derive docker image deploy-tag according to the publish-* steps in this config | ||
branch_tag_suffix=`echo "$CIRCLE_SHA1" | cut -c 1-8` | ||
sanitized_branch=`echo $CIRCLE_BRANCH | sed 's:/:-:g'` | ||
deploy_branch=${sanitized_branch}-${branch_tag_suffix} | ||
sanitized_tag=`echo $CIRCLE_TAG | sed 's:/:-:g'` | ||
|
||
# if $sanitized_tag is empty, default to $sanitized_branch | ||
deploy_target=${sanitized_tag:-$deploy_branch} | ||
|
||
# curlf fails with a non-zero exit code when the status code is not 2XX | ||
curlf() { | ||
OUTPUT_FILE=$(mktemp) | ||
HTTP_CODE=$(curl --silent --output $OUTPUT_FILE --write-out "%{http_code}" "$@") | ||
if [[ ${HTTP_CODE} -lt 200 || ${HTTP_CODE} -gt 299 ]] ; then | ||
>&2 cat $OUTPUT_FILE | ||
return 22 | ||
fi | ||
cat $OUTPUT_FILE | ||
rm $OUTPUT_FILE | ||
} | ||
|
||
# trigger deployment in sentinel-infra repo | ||
curlf --request POST \ | ||
--url https://circleci.com/api/v2/project/gh/filecoin-project/sentinel-infra/pipeline \ | ||
--header "Circle-Token: $SENTINEL_INFRA_CIRCLECI_API_TOKEN" \ | ||
--header "content-type: application/json" \ | ||
--data "{\"branch\":\"master\",\"parameters\":{\"trigger-deploy\": true, \"deploy-tag\":\"$deploy_target\"}}" | ||
echo "" | ||
validate-docker-executeable: | ||
steps: | ||
- run: | ||
|
@@ -89,7 +55,8 @@ jobs: | |
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin | ||
sanitized_branch=`echo $CIRCLE_BRANCH | sed 's:/:-:g'` | ||
tag_suffix=$(echo "$CIRCLE_SHA1" | cut -c 1-8) | ||
make docker-mainnet-push LILY_IMAGE_TAG=${sanitized_branch}-${tag_suffix} | ||
tag_date=$(date +%Y%m%d%H%M) | ||
make docker-mainnet-push LILY_IMAGE_TAG=${sanitized_branch}-${tag_date}-${tag_suffix} | ||
publish-production-image-from-branch-for-calibnet: | ||
executor: dockerizer | ||
steps: | ||
|
@@ -170,16 +137,6 @@ jobs: | |
if [[ "$CIRCLE_TAG" =~ ^(v[0-9]+\.[0-9]+\.[0-9]+)$ ]]; then | ||
LILY_IMAGE_TAG=butterflynet-latest make docker-butterflynet-push | ||
fi | ||
# duplicated jobs are for making these jobs' descriptions | ||
# in the pipelines within the CircleCI less confusing | ||
trigger-branch-deployment-for-all-networks: | ||
executor: dockerizer | ||
steps: | ||
- trigger-deployment | ||
trigger-semver-tag-deployment-for-all-networks: | ||
executor: dockerizer | ||
steps: | ||
- trigger-deployment | ||
mod-tidy-check: | ||
executor: golang | ||
steps: | ||
|
@@ -346,7 +303,7 @@ jobs: | |
# used in `build-docker-images` workflow below | ||
branch_filters: &branch_filters | ||
branches: | ||
only: /.*deploy.*/ | ||
only: /cd\/staging/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are reusing prior behavior. This causes us to detect changes on |
||
tags: | ||
ignore: /.*/ | ||
|
||
|
@@ -377,19 +334,13 @@ workflows: | |
- publish-production-image-from-branch-for-mainnet: | ||
filters: | ||
<<: *branch_filters | ||
- publish-production-image-from-branch-for-calibnet: | ||
filters: | ||
<<: *branch_filters | ||
- publish-production-image-from-branch-for-butterflynet: | ||
filters: | ||
<<: *branch_filters | ||
- trigger-branch-deployment-for-all-networks: | ||
requires: | ||
- publish-production-image-from-branch-for-mainnet | ||
- publish-production-image-from-branch-for-calibnet | ||
- publish-production-image-from-branch-for-butterflynet | ||
filters: | ||
<<: *branch_filters | ||
# only publish staging images for mainnet | ||
#- publish-production-image-from-branch-for-calibnet: | ||
#filters: | ||
#<<: *branch_filters | ||
#- publish-production-image-from-branch-for-butterflynet: | ||
#filters: | ||
#<<: *branch_filters | ||
- publish-production-image-from-semver-tag-for-mainnet: | ||
filters: | ||
<<: *tag_filters | ||
|
@@ -399,11 +350,4 @@ workflows: | |
- publish-production-image-from-semver-tag-for-butterflynet: | ||
filters: | ||
<<: *tag_filters | ||
- trigger-semver-tag-deployment-for-all-networks: | ||
requires: | ||
- publish-production-image-from-semver-tag-for-mainnet | ||
- publish-production-image-from-semver-tag-for-calibnet | ||
- publish-production-image-from-semver-tag-for-butterflynet | ||
filters: | ||
<<: *tag_filters | ||
|
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.
The new docker image tags that are created look like
cd-staging-${tag_date}-${tag_suffix}
. This is what we will filter on when deciding what to deploy into staging.