Trivy DB Download #2156
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# THIS FILE IS GENERATED, PLEASE DO NOT EDIT. | |
# | |
# Copyright 2023 Flant JSC | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: Trivy DB Download | |
on: | |
schedule: | |
- cron: '0 */6 * * *' | |
workflow_dispatch: | |
# Always run a single job at a time. | |
# Note: Concurrency is currently in beta and subject to change. | |
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency | |
concurrency: | |
group: trivy-db-download | |
jobs: | |
download-and-repush-images: | |
name: Download and repush images | |
runs-on: [self-hosted] | |
steps: | |
# <template: login_rw_registry_step> | |
- name: Check rw registry credentials | |
id: check_rw_registry | |
env: | |
HOST: ${{secrets.DECKHOUSE_REGISTRY_HOST}} | |
run: | | |
if [[ -n $HOST ]]; then | |
echo "has_credentials=true" >> $GITHUB_OUTPUT | |
echo "web_registry_path=${{secrets.DECKHOUSE_REGISTRY_HOST }}/deckhouse/site" >> $GITHUB_OUTPUT | |
fi | |
- name: Login to rw registry | |
uses: docker/[email protected] | |
if: ${{ steps.check_rw_registry.outputs.has_credentials == 'true' }} | |
with: | |
registry: ${{ secrets.DECKHOUSE_REGISTRY_HOST }} | |
username: ${{ secrets.DECKHOUSE_REGISTRY_USER }} | |
password: ${{ secrets.DECKHOUSE_REGISTRY_PASSWORD }} | |
logout: false | |
- name: Login to Github Container Registry | |
uses: docker/[email protected] | |
if: ${{ steps.check_rw_registry.outputs.has_credentials != 'true' }} | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GHCR_IO_REGISTRY_USER }} | |
password: ${{ secrets.GHCR_IO_REGISTRY_PASSWORD }} | |
logout: false | |
# </template: login_rw_registry_step> | |
# <template: login_dev_registry_step> | |
- name: Check dev registry credentials | |
id: check_dev_registry | |
env: | |
HOST: ${{secrets.DECKHOUSE_DEV_REGISTRY_HOST}} | |
run: | | |
if [[ -n $HOST ]]; then | |
echo "has_credentials=true" >> $GITHUB_OUTPUT | |
echo "web_registry_path=${{secrets.DECKHOUSE_DEV_REGISTRY_HOST }}/deckhouse/site" >> $GITHUB_OUTPUT | |
fi | |
- name: Login to dev registry | |
uses: docker/[email protected] | |
if: ${{ steps.check_dev_registry.outputs.has_credentials == 'true' }} | |
with: | |
registry: ${{ secrets.DECKHOUSE_DEV_REGISTRY_HOST }} | |
username: ${{ secrets.DECKHOUSE_DEV_REGISTRY_USER }} | |
password: ${{ secrets.DECKHOUSE_DEV_REGISTRY_PASSWORD }} | |
logout: false | |
# </template: login_dev_registry_step> | |
- name: Download custom trivy-db binary and copy image | |
run: | | |
rm -rf ./trivy-db && git clone --depth 1 --branch flant-latest ${{secrets.SOURCE_REPO}}/aquasecurity/trivy-db.git && cd trivy-db | |
./update.sh ${{secrets.DECKHOUSE_REGISTRY_HOST}}/deckhouse/ee/security/trivy-db:2 >/dev/null 2>&1 | |
./update.sh ${{secrets.DECKHOUSE_REGISTRY_HOST}}/deckhouse/fe/security/trivy-db:2 >/dev/null 2>&1 | |
./update.sh ${{secrets.DECKHOUSE_DEV_REGISTRY_HOST}}/sys/deckhouse-oss/security/trivy-db:2 >/dev/null 2>&1 | |
./update-vulnerability-references.sh ${{secrets.DECKHOUSE_REGISTRY_HOST}}/deckhouse/ee/security/trivy-bdu:1 >/dev/null 2>&1 | |
./update-vulnerability-references.sh ${{secrets.DECKHOUSE_REGISTRY_HOST}}/deckhouse/fe/security/trivy-bdu:1 >/dev/null 2>&1 | |
./update-vulnerability-references.sh ${{secrets.DECKHOUSE_DEV_REGISTRY_HOST}}/sys/deckhouse-oss/security/trivy-bdu:1 >/dev/null 2>&1 | |
./oras pull ghcr.io/aquasecurity/trivy-java-db:1 | |
./oras push --artifact-type application/vnd.aquasec.trivy.config.v1+json ${{secrets.DECKHOUSE_REGISTRY_HOST}}/deckhouse/ee/security/trivy-java-db:1 javadb.tar.gz:application/vnd.aquasec.trivy.javadb.layer.v1.tar+gzip | |
./oras push --artifact-type application/vnd.aquasec.trivy.config.v1+json ${{secrets.DECKHOUSE_REGISTRY_HOST}}/deckhouse/fe/security/trivy-java-db:1 javadb.tar.gz:application/vnd.aquasec.trivy.javadb.layer.v1.tar+gzip | |
./oras push --artifact-type application/vnd.aquasec.trivy.config.v1+json ${{secrets.DECKHOUSE_DEV_REGISTRY_HOST}}/sys/deckhouse-oss/security/trivy-java-db:1 javadb.tar.gz:application/vnd.aquasec.trivy.javadb.layer.v1.tar+gzip | |
rm -f javadb.tar.gz |