Skip to content

Migrate ACR cleanup to Azure OIDC #303

Migrate ACR cleanup to Azure OIDC

Migrate ACR cleanup to Azure OIDC #303

Workflow file for this run

name: CI
on:
push:
branches:
- 'main'
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
jobs:
build_debian_image:
name: Build epicbox/debian image
runs-on: arc-runners-small
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build
uses: ./.github/workflows/actions/build
with:
path: epicbox-debian
image_name: debian
image_tag: bullseye
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
add_hash: false
build_debian_images:
name: Build ${{ matrix.path }} image
needs: build_debian_image
runs-on: arc-runners-small
strategy:
fail-fast: false
matrix:
include:
- path: epicbox-gcc
image_name: gcc
image_tag: 10.2.1-1
- path: epicbox-hyperskill/gcc
image_name: hyperskill-gcc
image_tag: 10.2.1-1
- path: epicbox-mono
image_name: mono
image_tag: 6.10.0.104
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build
uses: ./.github/workflows/actions/build
with:
path: ${{ matrix.path }}
image_name: ${{ matrix.image_name }}
image_tag: ${{ matrix.image_tag }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
build_images:
name: Build ${{ matrix.path }} image
runs-on: arc-runners-small
strategy:
fail-fast: false
matrix:
include:
- path: epicbox-clojure
image_name: clojure
image_tag: tools-deps-1.11.1.1413-alpine
- path: epicbox-go
image_name: go
image_tag: 1.21-bullseye
- path: epicbox-haskell
image_name: haskell
image_tag: 8.8.4
- path: epicbox-hyperskill/go
image_name: hyperskill-go
image_tag: 1.21-bullseye
- path: epicbox-hyperskill/gradle
image_name: hyperskill-gradle
image_tag: 8.5.0-jdk17
- path: epicbox-hyperskill/gradle-spring
image_name: hyperskill-gradle-spring
image_tag: 8.5.0-jdk17
- path: epicbox-hyperskill/java
image_name: hyperskill-java
image_tag: 25-jdk-noble
- path: epicbox-hyperskill/node
image_name: hyperskill-node
image_tag: 18.20.4-bullseye-slim
- path: epicbox-hyperskill/node-javascript
image_name: hyperskill-node-javascript
image_tag: 18.20.4-bullseye-slim
- path: epicbox-hyperskill/python
image_name: hyperskill-python
image_tag: 3.10-slim
- path: epicbox-java
image_name: java
image_tag: 25-jdk-noble
- path: epicbox-kotlin
image_name: kotlin
image_tag: 2.0.0-jdk-23-slim
- path: epicbox-node
image_name: node
image_tag: 18.20.4-alpine
- path: epicbox-php
image_name: php
image_tag: 7.2.11-cli-alpine3.7
- path: epicbox-pmd
image_name: pmd
image_tag: 6.9.0-8u181-alpine
- path: epicbox-python/310
image_name: python
image_tag: 3.10.6-slim
- path: epicbox-python/311
image_name: python
image_tag: 3.11.5-slim
- path: epicbox-python/312
image_name: python
image_tag: 3.12.7-slim
- path: epicbox-ruby
image_name: ruby
image_tag: 2.5.3-alpine
- path: epicbox-scala/2
image_name: scala
image_tag: 2.13.12-8u342-slim
- path: epicbox-scala/3
image_name: scala
image_tag: 3.0.0-11.0.11-slim
- path: epicbox-typescript
image_name: typescript
image_tag: 4.8.4-18.20.4-bullseye-slim
- path: epicbox-hyperstyle
image_name: hyperstyle
image_tag: ij-2024.9
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build
uses: ./.github/workflows/actions/build
with:
path: ${{ matrix.path }}
image_name: ${{ matrix.image_name }}
image_tag: ${{ matrix.image_tag }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
clean_untagged_images:
name: Clean untagged images
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs:
- build_debian_image
- build_debian_images
- build_images
runs-on: arc-runners-small
timeout-minutes: 30
permissions:
contents: read
id-token: write
steps:
- name: Azure Login
uses: azure/login@v2
with:
client-id: ${{ vars.AZURE_CLIENT_ID }}
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
tenant-id: ${{ vars.AZURE_TENANT_ID }}
- name: Purge untagged Epicbox images
run: |
PURGE_CMD="acr purge \
--filter 'epicbox/.*:unknown.tag' \
--ago 0d \
--untagged"
az acr run \
--cmd "$PURGE_CMD" \
--registry hyperskill \
/dev/null