2021-06-28 04:45:29 -05:00
|
|
|
on:
|
|
|
|
push:
|
2022-01-06 15:21:44 -05:00
|
|
|
branches:
|
2021-10-21 13:13:14 -05:00
|
|
|
- main
|
2021-06-28 04:45:29 -05:00
|
|
|
pull_request:
|
|
|
|
branches:
|
2021-10-21 13:13:14 -05:00
|
|
|
- main
|
2021-06-28 04:45:29 -05:00
|
|
|
release:
|
|
|
|
types:
|
|
|
|
- published
|
|
|
|
name: build-test
|
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:
|
|
|
|
build-test:
|
2022-02-08 14:19:55 -05:00
|
|
|
name: Build and test ZOT
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Run build and test
|
|
|
|
timeout-minutes: 60
|
|
|
|
run: |
|
|
|
|
echo "job deprecated"
|
|
|
|
build-test-arch:
|
2021-12-03 22:50:58 -05:00
|
|
|
name: Build and test ZOT
|
2022-08-22 18:13:38 -05:00
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
packages: write
|
2021-06-28 04:45:29 -05:00
|
|
|
runs-on: ubuntu-latest
|
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:
|
2023-06-15 17:07:28 -05:00
|
|
|
- name: Remove unneeded tooling
|
|
|
|
run: |
|
|
|
|
# To free up ~15 GB of disk space
|
|
|
|
sudo rm -rf /opt/ghc
|
|
|
|
sudo rm -rf /usr/local/share/boost
|
|
|
|
sudo rm -rf /usr/local/lib/android
|
|
|
|
sudo rm -rf /usr/share/dotnet
|
2021-06-28 04:45:29 -05:00
|
|
|
- name: Install go
|
2023-03-22 14:33:21 -05:00
|
|
|
uses: actions/setup-go@v4
|
2021-06-28 04:45:29 -05:00
|
|
|
with:
|
2023-03-22 14:33:21 -05:00
|
|
|
cache: false
|
2023-04-27 02:09:46 -05:00
|
|
|
go-version: 1.20.x
|
2023-06-15 17:07:28 -05:00
|
|
|
|
2021-06-28 04:45:29 -05:00
|
|
|
- name: Check out source code
|
2022-07-13 16:15:33 -05:00
|
|
|
uses: actions/checkout@v3
|
2022-05-10 08:32:59 -05:00
|
|
|
- name: Cache go dependencies
|
|
|
|
id: cache-go-dependencies
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/go/pkg/mod
|
2023-02-04 02:57:07 -05:00
|
|
|
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-mod-
|
|
|
|
- name: Cache go build output
|
|
|
|
id: cache-go-build
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/go-build
|
|
|
|
key: ${{ matrix.os }}-${{ matrix.arch }}-go-build-${{ hashFiles('**/go.sum') }}
|
2022-05-10 08:32:59 -05:00
|
|
|
restore-keys: |
|
2023-02-04 02:57:07 -05:00
|
|
|
${{ matrix.os }}-${{ matrix.arch }}-go-build-
|
2022-05-10 08:32:59 -05:00
|
|
|
- name: Install go dependencies
|
|
|
|
if: steps.cache-go-dependencies.outputs.cache-hit != 'true'
|
2023-02-04 02:57:07 -05:00
|
|
|
run: |
|
|
|
|
cd $GITHUB_WORKSPACE
|
|
|
|
go mod download
|
2022-05-10 08:32:59 -05:00
|
|
|
- name: Install other dependencies
|
2021-06-28 04:45:29 -05:00
|
|
|
run: |
|
|
|
|
cd $GITHUB_WORKSPACE
|
2022-02-24 15:31:36 -05:00
|
|
|
go install github.com/swaggo/swag/cmd/swag@v1.6.3
|
2021-06-28 04:45:29 -05:00
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install rpm
|
2022-01-23 15:26:02 -05:00
|
|
|
sudo apt-get install snapd
|
|
|
|
sudo apt-get install libgpgme-dev libassuan-dev libbtrfs-dev libdevmapper-dev pkg-config
|
2023-06-16 02:28:43 -05:00
|
|
|
git clone https://github.com/containers/skopeo -b v1.12.0 $GITHUB_WORKSPACE/src/github.com/containers/skopeo
|
|
|
|
cd $GITHUB_WORKSPACE/src/github.com/containers/skopeo && \
|
|
|
|
make bin/skopeo && \
|
|
|
|
sudo cp bin/skopeo /usr/bin && \
|
|
|
|
rm -rf $GITHUB_WORKSPACE/src/github.com/containers/skopeo
|
2022-01-23 15:26:02 -05:00
|
|
|
cd $GITHUB_WORKSPACE
|
2021-10-29 21:10:55 -05:00
|
|
|
curl -Lo notation.tar.gz https://github.com/notaryproject/notation/releases/download/v0.7.1-alpha.1/notation_0.7.1-alpha.1_linux_amd64.tar.gz
|
|
|
|
sudo tar xvzf notation.tar.gz -C /usr/bin notation
|
2023-06-16 02:28:43 -05:00
|
|
|
rm -f notation.tar.gz
|
2022-01-23 15:26:02 -05:00
|
|
|
go install github.com/wadey/gocovmerge@latest
|
2022-12-23 14:19:51 -05:00
|
|
|
|
|
|
|
- if: matrix.os == 'linux' && matrix.arch == 'amd64'
|
|
|
|
name: Setup localstack service
|
|
|
|
run: |
|
2023-01-09 12:04:56 -05:00
|
|
|
pip install localstack # Install LocalStack cli
|
|
|
|
docker pull localstack/localstack:1.3 # Make sure to pull the latest version of the image
|
2022-12-23 14:19:51 -05:00
|
|
|
localstack start -d # Start LocalStack in the background
|
|
|
|
|
|
|
|
echo "Waiting for LocalStack startup..." # Wait 30 seconds for the LocalStack container
|
|
|
|
localstack wait -t 30 # to become ready before timing out
|
2023-03-10 13:37:29 -05:00
|
|
|
echo "Startup complete"
|
|
|
|
|
|
|
|
aws --endpoint-url=http://localhost:4566 s3api create-bucket --bucket zot-storage --region us-east-2 --create-bucket-configuration="{\"LocationConstraint\": \"us-east-2\"}"
|
2022-12-23 14:19:51 -05:00
|
|
|
aws dynamodb --endpoint-url http://localhost:4566 --region "us-east-2" create-table --table-name BlobTable --attribute-definitions AttributeName=Digest,AttributeType=S --key-schema AttributeName=Digest,KeyType=HASH --provisioned-throughput ReadCapacityUnits=10,WriteCapacityUnits=5
|
|
|
|
env:
|
|
|
|
AWS_ACCESS_KEY_ID: fake
|
|
|
|
AWS_SECRET_ACCESS_KEY: fake
|
2023-06-15 17:07:28 -05:00
|
|
|
|
|
|
|
- name: Check disk space before build
|
|
|
|
run: |
|
|
|
|
cd $GITHUB_WORKSPACE
|
|
|
|
set -x
|
|
|
|
df -h
|
|
|
|
sudo ls -lRh /tmp/* || true
|
|
|
|
sudo du -sh /tmp || true
|
|
|
|
sudo du -sh /tmp/* || true
|
|
|
|
sudo find /tmp/ -size +5M | sudo xargs ls -lh
|
|
|
|
du -sh ./* || true
|
|
|
|
find ./ -size +5M | xargs ls -lh
|
|
|
|
sudo du -sh /var/
|
|
|
|
sudo du -sh /var/lib/docker/
|
|
|
|
du -sh /home/runner/work/
|
|
|
|
set +x
|
|
|
|
|
2021-06-28 04:45:29 -05:00
|
|
|
- name: Run build and test
|
2023-01-23 12:45:11 -05:00
|
|
|
timeout-minutes: 80
|
2021-06-28 04:45:29 -05:00
|
|
|
run: |
|
2022-01-24 00:19:01 -05:00
|
|
|
echo "Building for $OS:$ARCH"
|
|
|
|
cd $GITHUB_WORKSPACE
|
2022-02-09 00:01:00 -05:00
|
|
|
if [[ $OS == "linux" && $ARCH == "amd64" ]]; then
|
2022-01-24 00:19:01 -05:00
|
|
|
make OS=$OS ARCH=$ARCH
|
2022-03-15 09:34:39 -05:00
|
|
|
sudo env "PATH=$PATH" make privileged-test
|
2022-01-24 00:19:01 -05:00
|
|
|
else
|
2023-02-23 15:28:08 -05:00
|
|
|
make OS=$OS ARCH=$ARCH binary binary-minimal binary-debug cli bench exporter-minimal
|
2022-01-24 00:19:01 -05:00
|
|
|
fi
|
2021-07-16 22:53:05 -05:00
|
|
|
env:
|
|
|
|
S3MOCK_ENDPOINT: localhost:4566
|
2022-11-22 13:29:57 -05:00
|
|
|
DYNAMODBMOCK_ENDPOINT: http://localhost:4566
|
2021-07-16 22:53:05 -05:00
|
|
|
AWS_ACCESS_KEY_ID: fake
|
|
|
|
AWS_SECRET_ACCESS_KEY: fake
|
2022-01-24 00:19:01 -05:00
|
|
|
OS: ${{ matrix.os }}
|
|
|
|
ARCH: ${{ matrix.arch }}
|
2023-06-15 17:07:28 -05:00
|
|
|
|
|
|
|
- name: Check disk space after build
|
|
|
|
if: always()
|
|
|
|
run: |
|
|
|
|
cd $GITHUB_WORKSPACE
|
|
|
|
set -x
|
|
|
|
df -h
|
|
|
|
sudo ls -lRh /tmp/* || true
|
|
|
|
sudo du -sh /tmp || true
|
|
|
|
sudo du -sh /tmp/* || true
|
|
|
|
sudo find /tmp/ -size +5M | sudo xargs ls -lh
|
|
|
|
du -sh ./* || true
|
|
|
|
find ./ -size +5M | xargs ls -lh
|
|
|
|
sudo du -sh /var/
|
|
|
|
sudo du -sh /var/lib/docker/
|
|
|
|
du -sh /home/runner/work/
|
|
|
|
set +x
|
|
|
|
|
2021-06-28 04:45:29 -05:00
|
|
|
- name: Upload code coverage
|
2022-07-18 12:23:05 -05:00
|
|
|
uses: codecov/codecov-action@v3
|
2023-02-18 02:10:28 -05:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
2022-10-17 12:41:53 -05:00
|
|
|
|
|
|
|
- name: Generate GraphQL Introspection JSON on Release
|
|
|
|
if: github.event_name == 'release' && github.event.action == 'published' && matrix.os == 'linux' && matrix.arch == 'amd64'
|
|
|
|
run: |
|
|
|
|
bin/zot-linux-amd64 serve examples/config-search.json &
|
|
|
|
sleep 10
|
|
|
|
curl -X POST -H "Content-Type: application/json" -d @.pkg/debug/githubWorkflows/introspection-query.json http://localhost:5000/v2/_zot/ext/search | jq > bin/zot-gql-introspection-result.json
|
|
|
|
pkill zot
|
|
|
|
|
2021-06-28 04:45:29 -05:00
|
|
|
- if: github.event_name == 'release' && github.event.action == 'published'
|
|
|
|
name: Publish artifacts on releases
|
2021-12-15 17:14:53 -05:00
|
|
|
uses: svenstaro/upload-release-action@v2
|
2021-06-28 04:45:29 -05:00
|
|
|
with:
|
2021-12-15 17:14:53 -05:00
|
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
2022-01-10 20:15:35 -05:00
|
|
|
file: bin/z*
|
2021-12-15 17:14:53 -05:00
|
|
|
tag: ${{ github.ref }}
|
|
|
|
overwrite: true
|
|
|
|
file_glob: true
|
2021-06-28 04:45:29 -05:00
|
|
|
|
|
|
|
push-image:
|
|
|
|
if: github.event_name == 'release' && github.event.action== 'published'
|
2022-04-07 06:48:54 -05:00
|
|
|
name: Push 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
|
|
|
|
security-events: write
|
|
|
|
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
|
2022-07-13 16:15:33 -05:00
|
|
|
uses: actions/checkout@v3
|
2021-06-28 04:45:29 -05:00
|
|
|
- name: Log in to GitHub Docker Registry
|
2022-07-25 13:11:19 -05:00
|
|
|
uses: docker/login-action@v2
|
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: Run zot container image with docker
|
|
|
|
run: |
|
|
|
|
if [[ $OS == "linux" && $ARCH == "amd64" ]]; then
|
2022-05-25 10:53:02 -05:00
|
|
|
docker run -d -p 5000:5000 ghcr.io/${{ github.repository_owner }}/zot-${{ matrix.os }}-${{ matrix.arch }}:${{ 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)
|
2022-04-07 06:48:54 -05:00
|
|
|
fi
|
|
|
|
env:
|
|
|
|
OS: ${{ matrix.os }}
|
|
|
|
ARCH: ${{ matrix.arch }}
|
|
|
|
- name: Run zot container image with podman
|
|
|
|
run: |
|
|
|
|
if [[ $OS == "linux" && $ARCH == "amd64" ]]; then
|
2022-05-25 10:53:02 -05:00
|
|
|
podman run -d -p 5000:5000 ghcr.io/${{ github.repository_owner }}/zot-${{ matrix.os }}-${{ matrix.arch }}:${{ 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
|
2022-04-07 06:48:54 -05:00
|
|
|
fi
|
|
|
|
env:
|
|
|
|
OS: ${{ matrix.os }}
|
|
|
|
ARCH: ${{ matrix.arch }}
|
|
|
|
- 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: Run zot-minimal container image with docker
|
|
|
|
run: |
|
|
|
|
if [[ $OS == "linux" && $ARCH == "amd64" ]]; then
|
2022-05-25 10:53:02 -05:00
|
|
|
docker run -d -p 5000:5000 ghcr.io/${{ github.repository_owner }}/zot-minimal-${{ matrix.os }}-${{ matrix.arch }}:${{ 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)
|
2022-04-07 06:48:54 -05:00
|
|
|
fi
|
|
|
|
env:
|
|
|
|
OS: ${{ matrix.os }}
|
|
|
|
ARCH: ${{ matrix.arch }}
|
|
|
|
- name: Run zot-minimal container image with podman
|
|
|
|
run: |
|
|
|
|
if [[ $OS == "linux" && $ARCH == "amd64" ]]; then
|
2022-05-25 10:53:02 -05:00
|
|
|
podman run -d -p 5000:5000 ghcr.io/${{ github.repository_owner }}/zot-minimal-${{ matrix.os }}-${{ matrix.arch }}:${{ 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
|
2022-04-07 06:48:54 -05:00
|
|
|
fi
|
|
|
|
env:
|
|
|
|
OS: ${{ matrix.os }}
|
|
|
|
ARCH: ${{ matrix.arch }}
|
|
|
|
- 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: Run zot-exporter container image with docker
|
|
|
|
run: |
|
|
|
|
if [[ $OS == "linux" && $ARCH == "amd64" ]]; then
|
2022-05-25 10:53:02 -05:00
|
|
|
docker run -d -p 5001:5001 ghcr.io/${{ github.repository_owner }}/zxp-${{ matrix.os }}-${{ matrix.arch }}:${{ 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)
|
2022-04-07 06:48:54 -05:00
|
|
|
fi
|
|
|
|
env:
|
|
|
|
OS: ${{ matrix.os }}
|
|
|
|
ARCH: ${{ matrix.arch }}
|
|
|
|
- name: Run zot-exporter container image with podman
|
|
|
|
run: |
|
|
|
|
if [[ $OS == "linux" && $ARCH == "amd64" ]]; then
|
2022-05-25 10:53:02 -05:00
|
|
|
podman run -d -p 5001:5001 ghcr.io/${{ github.repository_owner }}/zxp-${{ matrix.os }}-${{ matrix.arch }}:${{ 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
|
|
|
fi
|
|
|
|
env:
|
|
|
|
OS: ${{ matrix.os }}
|
|
|
|
ARCH: ${{ matrix.arch }}
|
|
|
|
- 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 }}
|
|
|
|
- name: Run zb container image with docker
|
|
|
|
run: |
|
|
|
|
if [[ $OS == "linux" && $ARCH == "amd64" ]]; then
|
2022-05-25 10:53:02 -05:00
|
|
|
docker run ghcr.io/${{ github.repository_owner }}/zb-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }} --help
|
2022-04-07 06:48:54 -05:00
|
|
|
fi
|
|
|
|
env:
|
|
|
|
OS: ${{ matrix.os }}
|
|
|
|
ARCH: ${{ matrix.arch }}
|
|
|
|
- name: Run zb container image with podman
|
|
|
|
run: |
|
|
|
|
if [[ $OS == "linux" && $ARCH == "amd64" ]]; then
|
2022-05-25 10:53:02 -05:00
|
|
|
podman run ghcr.io/${{ github.repository_owner }}/zb-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }} --help
|
2022-04-07 06:48:54 -05:00
|
|
|
fi
|
|
|
|
env:
|
|
|
|
OS: ${{ matrix.os }}
|
|
|
|
ARCH: ${{ matrix.arch }}
|
2022-03-10 23:07:49 -05:00
|
|
|
- name: Run Trivy vulnerability scanner
|
|
|
|
uses: aquasecurity/trivy-action@master
|
|
|
|
with:
|
|
|
|
image-ref: 'ghcr.io/${{ github.repository }}-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}'
|
|
|
|
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:
|
|
|
|
image-ref: 'ghcr.io/${{ github.repository }}-minimal-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}'
|
|
|
|
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
|
2023-06-19 14:34:50 -05:00
|
|
|
uses: github/codeql-action/upload-sarif@v2.20.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'
|
2023-05-10 11:53:39 -05:00
|
|
|
needs: push-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:
|
2022-07-13 16:15:33 -05:00
|
|
|
- uses: actions/checkout@v3
|
2022-07-08 11:16:46 -05:00
|
|
|
with:
|
|
|
|
ref: main
|
|
|
|
fetch-depth: '0'
|
|
|
|
|
|
|
|
- name: Checkout project-zot/helm-charts
|
2022-07-13 16:15:33 -05:00
|
|
|
uses: actions/checkout@v3
|
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:
|
|
|
|
cmd: yq -i '.image.tag = "${{ github.event.release.tag_name }}"' 'helm-charts/charts/zot/values.yaml'
|
|
|
|
- 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
|
|
|
|
git commit -am "Automated update of Helm Chart"
|
|
|
|
git push
|