Skip to content

Commit

Permalink
Add some of Salt's supported OS'es
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
  • Loading branch information
s0undt3ch committed Sep 21, 2023
1 parent 82213a1 commit 4345e7d
Show file tree
Hide file tree
Showing 16 changed files with 525 additions and 39 deletions.
145 changes: 145 additions & 0 deletions .github/workflows/almalinux-containers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
name: "AlmaLinux 🐳 Mirror"

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
push:
branches:
- '*'
paths:
- containers.yml
- '.github/workflows/almalinux-containers.yml'
- 'mirrors/almalinux/*'
pull_request:
paths:
- containers.yml
- '.github/workflows/almalinux-containers.yml'
- 'mirrors/almalinux/*'

env:
PATH_IN_REPO: mirrors/almalinux


concurrency:
# Concurrency is defined in a way that concurrent builds against branches do
# not cancel previous builds.
# However, for every new build against the same pull request source branch,
# all older builds against that same branch get canceled.
group: mirrors/almalinux-${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
matrix-generator:
name: "Mirror Matrix Generator"
runs-on: ubuntu-latest
outputs:
dockerinfo: ${{ steps.set-matrix.outputs.dockerinfo }}
steps:
- name: "Throttle Builds"
run: |
t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t
- name: "Fetching Repository Contents"
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install Requirements
run: |
python -m pip install -r requirements.txt
- name: "Generate Matrix Data"
id: set-matrix
run: |
inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }}
mirror-image:
runs-on: ubuntu-latest
needs: matrix-generator
name: "${{ matrix.dockerinfo.name }}"
strategy:
fail-fast: false
max-parallel: 4
matrix:
dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }}

permissions:
actions: read
checks: write
issues: read
packages: write
pull-requests: read
repository-projects: read
statuses: read

steps:
- name: "Fetching Repository Contents"
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install Requirements
run: |
python -m pip install -r requirements.txt
- name: "Throttle concurrent pushes"
run: |
t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t
- name: "Setup DockerFile"
run: |
echo " " >> ./${{matrix.dockerinfo.file}}
echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}}
echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}}
echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}}
echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}}
cat ./${{matrix.dockerinfo.file}}
- name: "Docker QEMU"
uses: docker/setup-qemu-action@v2

- name: "Docker BuildX"
id: buildx
uses: docker/setup-buildx-action@v2

- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
- name: Inspect Source Image
run: |
set -o pipefail
docker buildx imagetools inspect ${{ matrix.dockerinfo.source_container }} | tee -a source-container-inspect.txt
- name: Define Build Platforms
id: define-platforms
run: |
inv containers.platforms --exclude=linux/s390x,linux/mips64le source-container-inspect.txt
- name: "Log into GitHub Container Registry"
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: "Build & Publish"
uses: docker/build-push-action@v5
with:
file: ${{ matrix.dockerinfo.file }}
context: ${{ env.PATH_IN_REPO }}
platforms: ${{ steps.define-platforms.outputs.platforms }}
push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }}
tags: |
ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }}
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ on:
- '*'
paths:
- containers.yml
- '.github/workflows/amazon-linux-containers.yml'
- 'mirrors/amazon-linux/*'
- '.github/workflows/amazonlinux-containers.yml'
- 'mirrors/amazonlinux/*'
pull_request:
paths:
- containers.yml
- '.github/workflows/amazon-linux-containers.yml'
- 'mirrors/amazon-linux/*'
- '.github/workflows/amazonlinux-containers.yml'
- 'mirrors/amazonlinux/*'

env:
PATH_IN_REPO: mirrors/amazon-linux
PATH_IN_REPO: mirrors/amazonlinux


concurrency:
# Concurrency is defined in a way that concurrent builds against branches do
# not cancel previous builds.
# However, for every new build against the same pull request source branch,
# all older builds against that same branch get canceled.
group: mirrors/amazon-linux-${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.run_id }}
group: mirrors/amazonlinux-${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
Expand Down
145 changes: 145 additions & 0 deletions .github/workflows/archlinux-containers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
name: "ArchLinux 🐳 Mirror"

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
push:
branches:
- '*'
paths:
- containers.yml
- '.github/workflows/archlinux-containers.yml'
- 'mirrors/archlinux/*'
pull_request:
paths:
- containers.yml
- '.github/workflows/archlinux-containers.yml'
- 'mirrors/archlinux/*'

env:
PATH_IN_REPO: mirrors/archlinux


concurrency:
# Concurrency is defined in a way that concurrent builds against branches do
# not cancel previous builds.
# However, for every new build against the same pull request source branch,
# all older builds against that same branch get canceled.
group: mirrors/archlinux-${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
matrix-generator:
name: "Mirror Matrix Generator"
runs-on: ubuntu-latest
outputs:
dockerinfo: ${{ steps.set-matrix.outputs.dockerinfo }}
steps:
- name: "Throttle Builds"
run: |
t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t
- name: "Fetching Repository Contents"
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install Requirements
run: |
python -m pip install -r requirements.txt
- name: "Generate Matrix Data"
id: set-matrix
run: |
inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }}
mirror-image:
runs-on: ubuntu-latest
needs: matrix-generator
name: "${{ matrix.dockerinfo.name }}"
strategy:
fail-fast: false
max-parallel: 4
matrix:
dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }}

permissions:
actions: read
checks: write
issues: read
packages: write
pull-requests: read
repository-projects: read
statuses: read

steps:
- name: "Fetching Repository Contents"
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install Requirements
run: |
python -m pip install -r requirements.txt
- name: "Throttle concurrent pushes"
run: |
t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t
- name: "Setup DockerFile"
run: |
echo " " >> ./${{matrix.dockerinfo.file}}
echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}}
echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}}
echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}}
echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}}
cat ./${{matrix.dockerinfo.file}}
- name: "Docker QEMU"
uses: docker/setup-qemu-action@v2

- name: "Docker BuildX"
id: buildx
uses: docker/setup-buildx-action@v2

- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
- name: Inspect Source Image
run: |
set -o pipefail
docker buildx imagetools inspect ${{ matrix.dockerinfo.source_container }} | tee -a source-container-inspect.txt
- name: Define Build Platforms
id: define-platforms
run: |
inv containers.platforms --exclude=linux/s390x,linux/mips64le source-container-inspect.txt
- name: "Log into GitHub Container Registry"
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: "Build & Publish"
uses: docker/build-push-action@v5
with:
file: ${{ matrix.dockerinfo.file }}
context: ${{ env.PATH_IN_REPO }}
platforms: ${{ steps.define-platforms.outputs.platforms }}
push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }}
tags: |
ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }}
Loading

0 comments on commit 4345e7d

Please sign in to comment.