Skip to content
51 changes: 51 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -439,3 +439,54 @@ jobs:
env:
GH_TOKEN: ${{ secrets.WORKFLOW_PAT }}
run: gh release edit --tag "${{ github.event.release.tag_name }}" --prerelease=false "${{ github.event.release.name }}"

open-issue:
needs: [publish, image]
runs-on: ${{ inputs.other_jobs_runs_on }}
permissions:
contents: read
id-token: write
if: needs.image.outputs.prerelease == 'false'
steps:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to do the google-github-actions/auth@v3 and checkout also? This is a separate job.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wondered that... but it seemed to work... So I really don't know

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't need the checkout since it doesn't interact with any files in the repo itself though, right?

- uses: actions/checkout@v6
with:
# Either the workflow_dispatch ref, or the prerelease tag, whichever is set.
ref: ${{ github.event.inputs.ref }}${{ github.event.release.tag_name }}
- uses: google-github-actions/auth@v3
with:
service_account: depot-ci@ironcore-dev-1.iam.gserviceaccount.com
workload_identity_provider: projects/660542197445/locations/global/workloadIdentityPools/github-actions/providers/github-actions
- name: Populate list of licensed repos
run: |
# List the licensed image names, put into licensed-images.json
gcloud artifacts docker images list \
us-docker.pkg.dev/ironcore-images/licensed \
--format=json \
2>/dev/null \
| jq -r '.[].package' \
| sed 's|.*/||' \
| sort -u \
| jq -R . \
| jq -s . \
> licensed-images.json
cat licensed-images.json
- name: Check if produced image is in licensed repo list
id: check
run: |
IMAGE_NAME=$(echo "${{inputs.image_name}}" | sed 's|.*/||')
if jq -e --arg name "$IMAGE_NAME" 'any(.[]; . == $name)' licensed-images.json > /dev/null; then
echo "Match found"
echo "match=true" >> "$GITHUB_OUTPUT"
fi
- name: Create issue
uses: actions/github-script@v7
if: steps.check.outputs.match == 'true'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: "Deploy v${{ needs.image.outputs.longtag }} to licensed repository",
body: "This issue serves as a reminder to deploy v${{ needs.image.outputs.longtag }} to the licensed repository. If we plan to skip this release, please close this issue."
})