2021-06-28 04:45:29 -05:00
|
|
|
on:
|
|
|
|
release:
|
|
|
|
types:
|
|
|
|
- published
|
2024-02-02 13:55:53 -05:00
|
|
|
name: Publish OCI images
|
2022-07-16 18:22:38 -05:00
|
|
|
|
2023-06-01 18:53:50 -05:00
|
|
|
permissions: read-all
|
2022-07-16 18:22:38 -05:00
|
|
|
|
2021-06-28 04:45:29 -05:00
|
|
|
jobs:
|
2024-02-02 13:55:53 -05:00
|
|
|
push-singlearch-image:
|
|
|
|
name: Push single arch OCI images to GitHub Packages
|
2021-06-28 04:45:29 -05:00
|
|
|
runs-on: ubuntu-latest
|
2023-02-23 15:28:08 -05:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
2022-01-24 00:19:01 -05:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [linux, darwin]
|
|
|
|
arch: [amd64, arm64]
|
2021-06-28 04:45:29 -05:00
|
|
|
steps:
|
|
|
|
- name: Check out the repo
|
2023-09-05 14:30:49 -05:00
|
|
|
uses: actions/checkout@v4
|
2021-06-28 04:45:29 -05:00
|
|
|
- name: Log in to GitHub Docker Registry
|
2023-09-18 13:34:57 -05:00
|
|
|
uses: docker/login-action@v3
|
2021-06-28 04:45:29 -05:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2022-04-07 06:48:54 -05:00
|
|
|
- name: Build and push zot container image
|
|
|
|
uses: project-stacker/stacker-build-push-action@main
|
2021-06-28 04:45:29 -05:00
|
|
|
with:
|
2022-11-10 15:09:39 -05:00
|
|
|
file: 'build/stacker.yaml'
|
2021-12-15 17:47:53 -05:00
|
|
|
build-args: |
|
2022-10-11 11:01:59 -05:00
|
|
|
RELEASE_TAG=${{ github.event.release.tag_name }}
|
2021-12-15 17:47:53 -05:00
|
|
|
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
2022-01-24 00:19:01 -05:00
|
|
|
OS=${{ matrix.os }}
|
|
|
|
ARCH=${{ matrix.arch }}
|
2022-04-07 06:48:54 -05:00
|
|
|
REPO_NAME=zot-${{ matrix.os }}-${{ matrix.arch }}
|
|
|
|
url: docker://ghcr.io/${{ github.repository_owner }}
|
|
|
|
tags: ${{ github.event.release.tag_name }} latest
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push zot-minimal container image
|
|
|
|
uses: project-stacker/stacker-build-push-action@main
|
2021-06-30 19:19:16 -05:00
|
|
|
with:
|
2023-02-23 15:28:08 -05:00
|
|
|
file: 'build/stacker-minimal.yaml'
|
2021-12-15 17:47:53 -05:00
|
|
|
build-args: |
|
2022-10-11 11:01:59 -05:00
|
|
|
RELEASE_TAG=${{ github.event.release.tag_name }}
|
2021-12-15 17:47:53 -05:00
|
|
|
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
2022-01-24 00:19:01 -05:00
|
|
|
OS=${{ matrix.os }}
|
|
|
|
ARCH=${{ matrix.arch }}
|
2022-04-07 06:48:54 -05:00
|
|
|
EXT=-minimal
|
|
|
|
REPO_NAME=zot-minimal-${{ matrix.os }}-${{ matrix.arch }}
|
|
|
|
url: docker://ghcr.io/${{ github.repository_owner }}
|
|
|
|
tags: ${{ github.event.release.tag_name }} latest
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push zot-exporter container image
|
|
|
|
uses: project-stacker/stacker-build-push-action@main
|
2022-01-17 09:36:13 -05:00
|
|
|
with:
|
2022-11-10 15:09:39 -05:00
|
|
|
file: 'build/stacker-zxp.yaml'
|
2022-01-17 09:36:13 -05:00
|
|
|
build-args: |
|
2022-10-15 03:14:15 -05:00
|
|
|
RELEASE_TAG=${{ github.event.release.tag_name }}
|
2022-01-17 09:36:13 -05:00
|
|
|
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
2022-01-24 00:19:01 -05:00
|
|
|
OS=${{ matrix.os }}
|
|
|
|
ARCH=${{ matrix.arch }}
|
2022-04-07 06:48:54 -05:00
|
|
|
REPO_NAME=zxp-${{ matrix.os }}-${{ matrix.arch }}
|
|
|
|
url: docker://ghcr.io/${{ github.repository_owner }}
|
|
|
|
tags: ${{ github.event.release.tag_name }} latest
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push zb container image
|
|
|
|
uses: project-stacker/stacker-build-push-action@main
|
2022-01-19 02:12:48 -05:00
|
|
|
with:
|
2022-11-10 15:09:39 -05:00
|
|
|
file: 'build/stacker-zb.yaml'
|
2022-01-19 02:12:48 -05:00
|
|
|
build-args: |
|
2022-10-15 03:14:15 -05:00
|
|
|
RELEASE_TAG=${{ github.event.release.tag_name }}
|
2022-01-19 02:12:48 -05:00
|
|
|
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
2022-01-24 00:19:01 -05:00
|
|
|
OS=${{ matrix.os }}
|
|
|
|
ARCH=${{ matrix.arch }}
|
2022-04-07 06:48:54 -05:00
|
|
|
REPO_NAME=zb-${{ matrix.os }}-${{ matrix.arch }}
|
|
|
|
url: docker://ghcr.io/${{ github.repository_owner }}
|
|
|
|
tags: ${{ github.event.release.tag_name }} latest
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2024-02-02 13:55:53 -05:00
|
|
|
|
|
|
|
push-multiarch-image:
|
|
|
|
name: Push multiarch OCI images to GitHub Packages
|
|
|
|
needs: push-singlearch-image
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
image: [zot, zot-minimal, zxp, zb]
|
|
|
|
steps:
|
|
|
|
- name: Check out the repo
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Log in to GitHub Docker Registry
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Run build
|
|
|
|
run: |
|
|
|
|
echo "Building multiarch image for ${{ matrix.image }}"
|
|
|
|
cd $GITHUB_WORKSPACE
|
|
|
|
make check-blackbox-prerequisites
|
|
|
|
export PATH=${PATH}:${GITHUB_WORKSPACE}/hack/tools/bin
|
|
|
|
./scripts/build_multiarch_image.sh --registry ghcr.io/${{ github.repository_owner }} \
|
|
|
|
--source-tag ${{ github.event.release.tag_name }} \
|
|
|
|
--destination-tags "${{ github.event.release.tag_name }} latest" \
|
|
|
|
--file build/multiarch-${{ matrix.image }}.json
|
|
|
|
|
|
|
|
test-image:
|
|
|
|
name: Test OCI images published to GitHub Packages
|
|
|
|
needs: push-multiarch-image
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
packages: read
|
|
|
|
steps:
|
|
|
|
- name: Log in to GitHub Docker Registry
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Run zot container image with docker
|
|
|
|
run: |
|
|
|
|
docker run -d -p 5000:5000 ghcr.io/${{ github.repository_owner }}/zot:${{ github.event.release.tag_name }}
|
|
|
|
sleep 2
|
|
|
|
curl --connect-timeout 5 \
|
|
|
|
--max-time 10 \
|
|
|
|
--retry 12 \
|
|
|
|
--retry-max-time 360 \
|
|
|
|
--retry-connrefused \
|
|
|
|
'http://localhost:5000/v2/'
|
|
|
|
docker kill $(docker ps -q)
|
|
|
|
- name: Run zot container image with podman
|
|
|
|
run: |
|
|
|
|
podman run -d -p 5000:5000 ghcr.io/${{ github.repository_owner }}/zot:${{ github.event.release.tag_name }}
|
|
|
|
sleep 2
|
|
|
|
curl --connect-timeout 5 \
|
|
|
|
--max-time 10 \
|
|
|
|
--retry 12 \
|
|
|
|
--retry-max-time 360 \
|
|
|
|
--retry-connrefused \
|
|
|
|
'http://localhost:5000/v2/'
|
|
|
|
podman kill --all
|
|
|
|
- name: Run zot-minimal container image with docker
|
|
|
|
run: |
|
|
|
|
docker run -d -p 5000:5000 ghcr.io/${{ github.repository_owner }}/zot-minimal:${{ github.event.release.tag_name }}
|
|
|
|
sleep 2
|
|
|
|
curl --connect-timeout 5 \
|
|
|
|
--max-time 10 \
|
|
|
|
--retry 12 \
|
|
|
|
--retry-max-time 360 \
|
|
|
|
--retry-connrefused \
|
|
|
|
'http://localhost:5000/v2/'
|
|
|
|
docker kill $(docker ps -q)
|
|
|
|
- name: Run zot-minimal container image with podman
|
|
|
|
run: |
|
|
|
|
podman run -d -p 5000:5000 ghcr.io/${{ github.repository_owner }}/zot-minimal:${{ github.event.release.tag_name }}
|
|
|
|
sleep 2
|
|
|
|
curl --connect-timeout 5 \
|
|
|
|
--max-time 10 \
|
|
|
|
--retry 12 \
|
|
|
|
--retry-max-time 360 \
|
|
|
|
--retry-connrefused \
|
|
|
|
'http://localhost:5000/v2/'
|
|
|
|
podman kill --all
|
|
|
|
- name: Run zot-exporter container image with docker
|
|
|
|
run: |
|
|
|
|
docker run -d -p 5001:5001 ghcr.io/${{ github.repository_owner }}/zxp:${{ github.event.release.tag_name }}
|
|
|
|
sleep 2
|
|
|
|
curl --connect-timeout 5 \
|
|
|
|
--max-time 10 \
|
|
|
|
--retry 12 \
|
|
|
|
--retry-max-time 360 \
|
|
|
|
--retry-connrefused \
|
|
|
|
'http://localhost:5001/metrics'
|
|
|
|
docker kill $(docker ps -q)
|
|
|
|
- name: Run zot-exporter container image with podman
|
|
|
|
run: |
|
|
|
|
podman run -d -p 5001:5001 ghcr.io/${{ github.repository_owner }}/zxp:${{ github.event.release.tag_name }}
|
|
|
|
sleep 2
|
|
|
|
curl --connect-timeout 5 \
|
|
|
|
--max-time 10 \
|
|
|
|
--retry 12 \
|
|
|
|
--retry-max-time 360 \
|
|
|
|
--retry-connrefused \
|
|
|
|
'http://localhost:5001/metrics'
|
|
|
|
podman kill --all
|
2022-04-07 06:48:54 -05:00
|
|
|
- name: Run zb container image with docker
|
|
|
|
run: |
|
2024-02-02 13:55:53 -05:00
|
|
|
docker run ghcr.io/${{ github.repository_owner }}/zb:${{ github.event.release.tag_name }} --help
|
2022-04-07 06:48:54 -05:00
|
|
|
- name: Run zb container image with podman
|
|
|
|
run: |
|
2024-02-02 13:55:53 -05:00
|
|
|
podman run ghcr.io/${{ github.repository_owner }}/zb:${{ github.event.release.tag_name }} --help
|
|
|
|
|
|
|
|
scan-image:
|
|
|
|
name: Run Trivy scan on OCI images published to GitHub Packages
|
|
|
|
needs: push-singlearch-image
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
security-events: write
|
|
|
|
packages: read
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [linux, darwin]
|
|
|
|
arch: [amd64, arm64]
|
|
|
|
steps:
|
|
|
|
- name: Log in to GitHub Docker Registry
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Run Trivy vulnerability scanner
|
|
|
|
uses: aquasecurity/trivy-action@master
|
|
|
|
with:
|
|
|
|
image-ref: 'ghcr.io/${{ github.repository_owner }}/zot-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}'
|
|
|
|
format: 'sarif'
|
|
|
|
output: 'trivy-results.sarif'
|
2022-04-07 06:48:54 -05:00
|
|
|
env:
|
2024-02-02 13:55:53 -05:00
|
|
|
TRIVY_USERNAME: ${{ github.actor }}
|
|
|
|
TRIVY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Run Trivy vulnerability scanner (minimal)
|
|
|
|
uses: aquasecurity/trivy-action@master
|
|
|
|
with:
|
|
|
|
image-ref: 'ghcr.io/${{ github.repository_owner }}/zot-minimal-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}'
|
|
|
|
format: 'sarif'
|
|
|
|
output: 'trivy-results.sarif'
|
|
|
|
env:
|
|
|
|
TRIVY_USERNAME: ${{ github.actor }}
|
|
|
|
TRIVY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Upload Trivy scan results to GitHub Security tab
|
2024-10-30 06:09:36 -05:00
|
|
|
uses: github/codeql-action/upload-sarif@v3.27.0
|
2024-02-02 13:55:53 -05:00
|
|
|
with:
|
|
|
|
sarif_file: 'trivy-results.sarif'
|
|
|
|
|
|
|
|
scan-multiarch-image:
|
|
|
|
name: Run Trivy scan on OCI multiarch images published to GitHub Packages
|
|
|
|
needs: push-multiarch-image
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
security-events: write
|
|
|
|
packages: read
|
|
|
|
steps:
|
|
|
|
- name: Log in to GitHub Docker Registry
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2022-03-10 23:07:49 -05:00
|
|
|
- name: Run Trivy vulnerability scanner
|
|
|
|
uses: aquasecurity/trivy-action@master
|
|
|
|
with:
|
2024-02-02 13:55:53 -05:00
|
|
|
image-ref: 'ghcr.io/${{ github.repository_owner }}/zot:${{ github.event.release.tag_name }}'
|
2022-03-10 23:07:49 -05:00
|
|
|
format: 'sarif'
|
|
|
|
output: 'trivy-results.sarif'
|
2022-04-07 06:48:54 -05:00
|
|
|
env:
|
|
|
|
TRIVY_USERNAME: ${{ github.actor }}
|
|
|
|
TRIVY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
|
2022-03-10 23:07:49 -05:00
|
|
|
- name: Run Trivy vulnerability scanner (minimal)
|
|
|
|
uses: aquasecurity/trivy-action@master
|
|
|
|
with:
|
2024-02-02 13:55:53 -05:00
|
|
|
image-ref: 'ghcr.io/${{ github.repository_owner }}/zot-minimal:${{ github.event.release.tag_name }}'
|
2022-03-10 23:07:49 -05:00
|
|
|
format: 'sarif'
|
|
|
|
output: 'trivy-results.sarif'
|
2022-04-07 06:48:54 -05:00
|
|
|
env:
|
|
|
|
TRIVY_USERNAME: ${{ github.actor }}
|
|
|
|
TRIVY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
|
2022-03-10 23:07:49 -05:00
|
|
|
- name: Upload Trivy scan results to GitHub Security tab
|
2024-10-30 06:09:36 -05:00
|
|
|
uses: github/codeql-action/upload-sarif@v3.27.0
|
2022-03-10 23:07:49 -05:00
|
|
|
with:
|
|
|
|
sarif_file: 'trivy-results.sarif'
|
2022-07-08 11:16:46 -05:00
|
|
|
|
|
|
|
update-helm-chart:
|
|
|
|
if: github.event_name == 'release' && github.event.action== 'published'
|
2024-02-02 13:55:53 -05:00
|
|
|
needs: push-multiarch-image
|
2022-07-08 11:16:46 -05:00
|
|
|
name: Update Helm Chart
|
2023-06-01 18:53:50 -05:00
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
packages: write
|
2022-07-08 11:16:46 -05:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-05 14:30:49 -05:00
|
|
|
- uses: actions/checkout@v4
|
2022-07-08 11:16:46 -05:00
|
|
|
with:
|
|
|
|
ref: main
|
|
|
|
fetch-depth: '0'
|
|
|
|
|
|
|
|
- name: Checkout project-zot/helm-charts
|
2023-09-05 14:30:49 -05:00
|
|
|
uses: actions/checkout@v4
|
2022-07-08 11:16:46 -05:00
|
|
|
with:
|
|
|
|
repository: project-zot/helm-charts
|
|
|
|
ref: main
|
|
|
|
fetch-depth: '0'
|
2022-07-12 06:57:45 -05:00
|
|
|
token: ${{ secrets.HELM_PUSH_TOKEN }}
|
2022-07-08 11:16:46 -05:00
|
|
|
path: ./helm-charts
|
|
|
|
|
|
|
|
- name: Configure Git
|
|
|
|
run: |
|
|
|
|
git config --global user.name 'github-actions'
|
|
|
|
git config --global user.email 'github-actions@users.noreply.github.com'
|
|
|
|
- name: Update appVersion
|
|
|
|
uses: mikefarah/yq@master
|
|
|
|
with:
|
|
|
|
cmd: yq -i '.appVersion = "${{ github.event.release.tag_name }}"' 'helm-charts/charts/zot/Chart.yaml'
|
|
|
|
- name: Update image tag
|
|
|
|
uses: mikefarah/yq@master
|
|
|
|
with:
|
2023-11-24 03:40:42 -05:00
|
|
|
cmd: |
|
|
|
|
yq e '.image.tag = "${{ github.event.release.tag_name }}"' 'helm-charts/charts/zot/values.yaml' > values-updated.yaml
|
|
|
|
- name: Patch values.yaml file
|
|
|
|
run: |
|
|
|
|
diff -b 'helm-charts/charts/zot/values.yaml' values-updated.yaml > values.diff || true
|
|
|
|
patch 'helm-charts/charts/zot/values.yaml' < values.diff
|
|
|
|
rm values-updated.yaml values.diff
|
2022-07-08 11:16:46 -05:00
|
|
|
- name: Update version
|
|
|
|
run: |
|
|
|
|
sudo apt-get install pip
|
|
|
|
pip install pybump
|
|
|
|
pybump bump --file helm-charts/charts/zot/Chart.yaml --level patch
|
|
|
|
- name: Push changes to project-zot/helm-charts
|
|
|
|
run: |
|
|
|
|
cd ./helm-charts
|
2023-06-28 12:42:31 -05:00
|
|
|
git commit -am "build: automated update of Helm Chart"
|
2022-07-08 11:16:46 -05:00
|
|
|
git push
|