From b9da479e813de6aa19faf997ccb1f513b256a4f3 Mon Sep 17 00:00:00 2001 From: Mike Greenberg Date: Tue, 15 Nov 2022 18:53:56 -0500 Subject: [PATCH 1/4] chore(ci): Trigger docker build for branch cd/staging --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3cdd294eb..3c79af84d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -346,7 +346,7 @@ jobs: # used in `build-docker-images` workflow below branch_filters: &branch_filters branches: - only: /.*deploy.*/ + only: /cd\/staging/ tags: ignore: /.*/ From 78bcbe07d016832796d7d0642f32a9a0bca7e66b Mon Sep 17 00:00:00 2001 From: Mike Greenberg Date: Tue, 15 Nov 2022 18:55:07 -0500 Subject: [PATCH 2/4] chore(ci): Cleanup unused jobs --- .circleci/config.yml | 71 +++++--------------------------------------- 1 file changed, 7 insertions(+), 64 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3c79af84d..b5a25e4fa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: @@ -170,16 +136,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: @@ -377,19 +333,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 +349,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 From b8ac5857bdc532835d2490b7bf4bb38b21a74d11 Mon Sep 17 00:00:00 2001 From: Mike Greenberg Date: Tue, 15 Nov 2022 19:05:11 -0500 Subject: [PATCH 3/4] chore(ci): Add timestamp to image tag to order for latest --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b5a25e4fa..98c8d940a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -55,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: From 8996486cb6eb2924993982b808331c4996a2d5b2 Mon Sep 17 00:00:00 2001 From: Mike Greenberg Date: Tue, 15 Nov 2022 19:50:02 -0500 Subject: [PATCH 4/4] fix(ci): Stricter token matching on cd/staging --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 98c8d940a..ef67d9993 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -303,7 +303,7 @@ jobs: # used in `build-docker-images` workflow below branch_filters: &branch_filters branches: - only: /cd\/staging/ + only: /^cd\/staging$/ tags: ignore: /.*/