push dependent images to artifactory #1
Workflow file for this run
This file contains hidden or 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
| name: Push Dependent Images to Artifactory | |
| on: | |
| push: | |
| branches: | |
| - devops/artifactory-0.5.0 | |
| workflow_dispatch: | |
| env: | |
| ARTIFACTORY_REGISTRY: ${{ secrets.ARTIFACTORY_REGISTRY }} | |
| ARTIFACTORY_REPO: ${{ secrets.ARTIFACTORY_REPO }} | |
| ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }} | |
| ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} | |
| METABASE_IMAGE_TAG: v0.50.6 | |
| jobs: | |
| push-dependent-images-to-artifactory: | |
| name: Push dependent images to Artifactory | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install skopeo | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y skopeo | |
| - name: Login to Artifactory | |
| run: | | |
| set -euo pipefail | |
| AUTH_CURL_FLAGS=(-H "X-JFrog-Art-Api: ${ARTIFACTORY_API_KEY}") | |
| AUTH_PASSWORD="${ARTIFACTORY_API_KEY}" | |
| curl -fsS "${AUTH_CURL_FLAGS[@]}" \ | |
| "https://${ARTIFACTORY_REGISTRY}/artifactory/api/system/ping" | |
| REPO_INFO="$(curl -fsS "${AUTH_CURL_FLAGS[@]}" \ | |
| "https://${ARTIFACTORY_REGISTRY}/artifactory/api/repositories/${ARTIFACTORY_REPO}")" | |
| echo "${REPO_INFO}" | tr -d '\n' | grep -Eq '"packageType"[[:space:]]*:[[:space:]]*"docker"' || \ | |
| { echo "Repo ${ARTIFACTORY_REPO} is not a Docker repo."; exit 1; } | |
| echo "${REPO_INFO}" | tr -d '\n' | grep -Eq '"rclass"[[:space:]]*:[[:space:]]*"(local|virtual|federated)"' || \ | |
| { echo "Repo ${ARTIFACTORY_REPO} must be local or virtual or federated."; exit 1; } | |
| skopeo login --authfile /tmp/artifactory-auth.json \ | |
| --username "${ARTIFACTORY_USERNAME}" \ | |
| --password "${AUTH_PASSWORD}" \ | |
| "${ARTIFACTORY_REGISTRY}" | |
| - name: Copy Metabase image from Docker Hub | |
| run: | | |
| set -euo pipefail | |
| echo "Pushing Metabase image" | |
| skopeo copy --src-tls-verify=true --dest-tls-verify=true \ | |
| --dest-authfile /tmp/artifactory-auth.json \ | |
| "docker://metabase/metabase:${METABASE_IMAGE_TAG}" \ | |
| "docker://${ARTIFACTORY_REGISTRY}/${ARTIFACTORY_REPO}/cthub/prod/metabase/metabase:${METABASE_IMAGE_TAG}" |