Skip to content

Commit

Permalink
Change how to promote builds to use Artifactory for CI/CD
Browse files Browse the repository at this point in the history
Now that Artifactory will be used as the docker registry,
update how the promotion happens by using the Docker Promotion
feature

github: Set common env var in the root of the file

Some of the env vars are being used in multiple stages,
so instead of having to hard-code some small differences
in multiple places, bring it all back to a root level
where it's easier to see what changes for what environment.
  • Loading branch information
derrix060 authored and kirugan committed Jun 27, 2024
1 parent ca1dd75 commit 65c096f
Showing 1 changed file with 25 additions and 45 deletions.
70 changes: 25 additions & 45 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
name: Docker Build, Publish and Deploy

env:
DOCKER_REGISTRY: nethermind.jfrog.io

REPO_DEV: angkor-docker-local-dev
REPO_STAGING: angkor-docker-local-staging
REPO_PROD: angkor-docker-local-prod


on:
push:
branches: [main]
Expand Down Expand Up @@ -29,15 +37,16 @@ jobs:

- name: Login to registry
run: |
docker login nethermind.jfrog.io -u [email protected] -p ${{ secrets.ARTIFACTORY_ANGKOR_CONTRIBUTOR }}
docker login ${{ env.DOCKER_REGISTRY }} -u ${{ vars.ARTIFACTORY_ANGKOR_USER }} -p ${{ secrets.ARTIFACTORY_ANGKOR_CONTRIBUTOR }}
- name: Build and Push
uses: docker/build-push-action@v5
with:
context: .
platforms: "linux/amd64"
push: true
tags: nethermind.jfrog.io/angkor-docker-local-dev/juno:${{ env.DOCKER_IMAGE_TAG }}
tags: ${{ env.DOCKER_REGISTRY }}/${{ env.REPO_DEV }}/juno:${{ env.DOCKER_IMAGE_TAG }}


validate_dev:
permissions:
Expand All @@ -51,19 +60,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Repository Dispatch Dev
env:
EVENT_NAME: juno-dev
SEPOLIA: apps/juno-dev/overlays/dev-sepolia/config.yaml
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.ACCESS_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/NethermindEth/argo/dispatches \
-d '{"event_type": "${{ env.EVENT_NAME }}", "client_payload":{"name": "${{ env.EVENT_NAME }}", "sepolia_config": "${{ env.SEPOLIA }}", "tag": "${{ env.DOCKER_IMAGE_TAG }}"}}'
- name: Verify Deployment Version (Dev)
run: bash .github/workflow-scripts/verify_deployment.sh ${{ secrets.DEV_SEPOLIA_URL }} ${{ env.DOCKER_IMAGE_TAG }}

Expand All @@ -87,26 +83,15 @@ jobs:
environment:
name: Staging
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Repository Dispatch Staging
- name: Setup JFrog CLI
uses: jfrog/setup-jfrog-cli@v4
env:
EVENT_NAME: juno-staging
MAINNET: apps/juno-staging/overlays/staging-mainnet/config.yaml
SEPOLIA: apps/juno-staging/overlays/staging-sepolia/config.yaml
SEPOLIA_INTEGRATION: apps/juno-staging/overlays/staging-sepolia-integration/config.yaml
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.ACCESS_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/NethermindEth/argo/dispatches \
-d '{"event_type": "${{ env.EVENT_NAME }}", "client_payload":{"name": "${{ env.EVENT_NAME }}", "mainnet_config": "${{ env.MAINNET }}", "sepolia_config": "${{ env.SEPOLIA }}", "sepolia_integration_config": "${{ env.SEPOLIA_INTEGRATION}}", "tag": "${{ env.DOCKER_IMAGE_TAG }}"}}'
JF_URL: ${{ vars.JFROG_URL}}
JF_ACCESS_TOKEN: ${{ secrets.ARTIFACTORY_ANGKOR_CONTRIBUTOR }}

- name: Verify Deployment Version (Staging)
run: bash .github/workflow-scripts/verify_deployment.sh ${{ secrets.STAGING_SEPOLIA_URL }} ${{ env.DOCKER_IMAGE_TAG }}
- name: Promote to Staging
run: |
jf rt dpr juno/${{ env.DOCKER_IMAGE_TAG }} ${{ env.REPO_DEV }} ${{ env.REPO_STAGING }}
staging-starknet-rs-tests:
needs: [promote_to_staging]
Expand All @@ -128,20 +113,15 @@ jobs:
environment:
name: Production
steps:
- name: Repository Dispatch Prod
- name: Setup JFrog CLI
uses: jfrog/setup-jfrog-cli@v4
env:
EVENT_NAME: juno-prod
MAINNET: apps/juno-prod/overlays/prod-mainnet/config.yaml
SEPOLIA: apps/juno-prod/overlays/prod-sepolia/config.yaml
SEPOLIA_INTEGRATION: apps/juno-prod/overlays/prod-sepolia-integration/config.yaml
JF_URL: ${{ vars.JFROG_URL}}
JF_ACCESS_TOKEN: ${{ secrets.ARTIFACTORY_ANGKOR_CONTRIBUTOR }}

- name: Promote to Production
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.ACCESS_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/NethermindEth/argo/dispatches \
-d '{"event_type": "${{ env.EVENT_NAME }}", "client_payload":{"name": "${{ env.EVENT_NAME }}", "mainnet_config": "${{ env.MAINNET }}", "sepolia_config": "${{ env.SEPOLIA }}", "sepolia_integration_config": "${{ env.SEPOLIA_INTEGRATION }}", "tag": "${{ env.DOCKER_IMAGE_TAG }}"}}'
jf rt dpr juno/${{ env.DOCKER_IMAGE_TAG }} ${{ env.REPO_STAGING }} ${{ env.REPO_PROD }}
prod-starknet-rs-tests:
needs: [promote_to_production]
Expand Down

0 comments on commit 65c096f

Please sign in to comment.