I am unable to push built Docker images to GCP Artifact Registry, despite GCP SDK & auth being configured successfully.
This is my GithubActions pipeline setup:
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Set up GCP SDK
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
- name: Configure Docker to use GCP
run: gcloud auth configure-docker $CONTAINER_REGISTRY
- name: Build and Push Docker image
env:
SHA_TAG: ${{ github.sha }}
ENV_TAG: dev
run: |
docker build -t $CONTAINER_REGISTRY/$SERVICE_NAME:$SHA_TAG -t $CONTAINER_REGISTRY/$SERVICE_NAME:$ENV_TAG -t $CONTAINER_REGISTRY/$SERVICE_NAME:latest .
docker push $CONTAINER_REGISTRY/$SERVICE_NAME:$SHA_TAG
docker push $CONTAINER_REGISTRY/$SERVICE_NAME:$ENV_TAG
docker push $CONTAINER_REGISTRY/$SERVICE_NAME:latest
As you can see in the screenshots below, all the steps conclude successfully, except the "push" part of the "Build and Push docker image" step:
Not really sure what's the issue here.
You are not using a valid image path to push to, the path has to be of the form
$CONTAINER_REGISTRY/$PROJECT/$REPO/$SERVICE_NAME:$TAG