Skip to content
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

Run Argo CD app sync after image is published from PR #11750

Merged
merged 14 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/build-publish-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
build-publish-untrusted:
if: ${{ ! startsWith(github.ref_name, 'release/') }}
runs-on: ubuntu-20.04
environment: sdlc
chainchad marked this conversation as resolved.
Show resolved Hide resolved
permissions:
id-token: write
contents: read
Expand Down Expand Up @@ -53,6 +54,51 @@ jobs:
dockerhub_username: ${{ secrets.DOCKERHUB_READONLY_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_READONLY_PASSWORD }}

- name: Get PR labels
erikburt marked this conversation as resolved.
Show resolved Hide resolved
id: pr-labels
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.number }}
run: |
RESPONSE=$(gh pr view ${PR_NUMBER} --json labels)
# Check if the labels command was successful
if [[ $? -ne 0 ]]; then
echo "Error fetching labels"
exit 1
fi
echo "RESPONSE=${RESPONSE}"
LABELS=$(echo "$RESPONSE" | jq -r '.labels | map(.name) | join(", ")')
# Check if any labels were found
if [[ -z "${LABELS:-}" ]]; then
echo "No labels found"
else
echo "labels=${LABELS}" | tee -a "${GITHUB_OUTPUT}"
fi

- name: Setup GAP
if: contains(steps.pr-labels.outputs.labels, 'crib')
uses: smartcontractkit/.github/actions/setup-gap@main
with:
aws-region: ${{ secrets.AWS_REGION }}
aws-role-arn: ${{ secrets.AWS_OIDC_IAM_ROLE_PUBLISH_PR_ARN }}
api-gateway-host: ${{ secrets.AWS_API_GW_HOST_ARGO_SAND }}
use-argocd: "true"
argocd-user: ${{ secrets.ARGOCD_USER_SAND }}
argocd-pass: ${{ secrets.ARGOCD_PASS_SAND }}

# Run an Argo CD sync after the image is built.
- name: Argo CD App Sync
if: contains(steps.pr-labels.outputs.labels, 'crib')
shell: bash
env:
PR_NUMBER: ${{ github.event.number }}
run: |
argocd app sync \
--plaintext \
--grpc-web \
--async \
"crib-chainlink-${PR_NUMBER}"

- name: Collect Metrics
if: always()
id: collect-gha-metrics
Expand Down
Empty file added test.txt
Empty file.
Loading