Skip to content

Commit b51fff7

Browse files
mchmarnyclaude
andcommitted
fix: add GHCR authentication for image copy
The crane copy command needs authentication to pull from GHCR. Add ghcr_token input and authenticate before copying. Also add test-deploy.yaml workflow for isolated testing of the deploy action without running the full release pipeline. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent de2e4c6 commit b51fff7

File tree

3 files changed

+70
-1
lines changed

3 files changed

+70
-1
lines changed

.github/actions/cloud-run-deploy/action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ inputs:
4141
description: 'Image name in target registry (e.g., eidosd)'
4242
required: false
4343
default: 'eidosd'
44+
ghcr_token:
45+
description: 'GitHub token for GHCR authentication (use github.token)'
46+
required: true
4447

4548
runs:
4649
using: 'composite'
@@ -98,6 +101,13 @@ runs:
98101
sudo chmod +x /usr/local/bin/crane
99102
rm -rf "$CRANE_TMP"
100103
104+
- name: Authenticate to GHCR
105+
shell: bash
106+
env:
107+
GHCR_TOKEN: ${{ inputs.ghcr_token }}
108+
run: |
109+
echo "${GHCR_TOKEN}" | crane auth login ghcr.io -u oauth2accesstoken --password-stdin
110+
101111
- name: Copy image to Artifact Registry
102112
id: copy
103113
shell: bash

.github/workflows/on-tag.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ jobs:
184184
- name: Checkout Code
185185
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
186186

187-
- name: Deploy API to Cloud Run
187+
- name: Deploy Demo API Server
188188
uses: ./.github/actions/cloud-run-deploy
189189
with:
190190
project_id: ${{ env.PROJECT_ID }}
@@ -195,3 +195,4 @@ jobs:
195195
source_image: "${{ env.SOURCE_IMAGE }}:${{ github.ref_name }}"
196196
target_registry: ${{ env.TARGET_REGISTRY }}
197197
image_name: 'eidosd'
198+
ghcr_token: ${{ github.token }}

.github/workflows/test-deploy.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Test Deploy Action
16+
17+
on:
18+
workflow_dispatch:
19+
inputs:
20+
image_tag:
21+
description: 'Image tag to deploy (e.g., v0.1.4)'
22+
required: true
23+
default: 'v0.1.4'
24+
25+
permissions:
26+
contents: read
27+
id-token: write
28+
packages: read
29+
30+
jobs:
31+
deploy:
32+
name: Test Deploy
33+
runs-on: ubuntu-latest
34+
timeout-minutes: 10
35+
env:
36+
IDENTITY_PROVIDER: 'projects/116689922666/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider'
37+
SERVICE_ACCOUNT: 'github-actions'
38+
PROJECT_ID: 'eidosx'
39+
RUN_REGION: 'us-west1'
40+
RUN_SERVICE: 'api'
41+
SOURCE_IMAGE: 'ghcr.io/nvidia/eidosd'
42+
TARGET_REGISTRY: 'us-docker.pkg.dev/eidosx/demo'
43+
steps:
44+
- name: Checkout Code
45+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
46+
47+
- name: Deploy Demo API Server
48+
uses: ./.github/actions/cloud-run-deploy
49+
with:
50+
project_id: ${{ env.PROJECT_ID }}
51+
workload_identity_provider: ${{ env.IDENTITY_PROVIDER }}
52+
service_account: "${{ env.SERVICE_ACCOUNT }}@${{ env.PROJECT_ID }}.iam.gserviceaccount.com"
53+
region: ${{ env.RUN_REGION }}
54+
service: ${{ env.RUN_SERVICE }}
55+
source_image: "${{ env.SOURCE_IMAGE }}:${{ inputs.image_tag }}"
56+
target_registry: ${{ env.TARGET_REGISTRY }}
57+
image_name: 'eidosd'
58+
ghcr_token: ${{ github.token }}

0 commit comments

Comments
 (0)