Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: pg-gvm image to harbor #80

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 54 additions & 18 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,56 +9,78 @@ on:
branches:
- main
workflow_dispatch:

jobs:
images:
name: Build and upload container images
runs-on: ubuntu-latest
generate:
name: Generate pg-gvm archive
runs-on:
- self-hosted
- self-hosted-generic
outputs:
labels: ${{ steps.meta.outputs.labels }}
feed-info: ${{ steps.feed-info.outputs.feed-version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: greenbone/actions/is-latest-tag@v3
id: latest
- name: Determine Feed Info
id: feed-info
run: |
echo "feed-version=$(date +"%Y%m%d%H%M")" >> $GITHUB_OUTPUT
- name: Setup container meta information
id: meta
id: labels
uses: docker/metadata-action@v5
with:
images: ${{ github.repository }}
labels: |
org.opencontainers.image.vendor=Greenbone
org.opencontainers.image.base.name=debian/stable-slim
flavor: latest=false # no latest container tag for git tags
ghcr:
needs: generate
name: Build and push to ghcr.io (for feed-deployment only!!!)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: greenbone/actions/checkout@v3
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.GREENBONE_BOT }}
password: ${{ secrets.GREENBONE_BOT_TOKEN }}
- name: Setup additional container meta information
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
# use version, major.minor and major for tags
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}

# use edge for default branch
type=edge

# set label for non-published pull request builds
type=ref,event=pr

# when a new git tag is created set stable and a latest tags
type=raw,value=latest,enable=${{ steps.latest.outputs.is-latest-tag == 'true' }}
type=raw,value=stable,enable=${{ steps.latest.outputs.is-latest-tag == 'true' }}
- name: Set container build options
id: container-opts
run: |
if [[ "${{ github.ref_type }}" = 'tag' ]]; then
echo "gvm-libs-version=oldstable" >> $GITHUB_OUTPUT
else
echo "gvm-libs-version=oldstable" >> $GITHUB_OUTPUT
else
echo "gvm-libs-version=oldstable-edge" >> $GITHUB_OUTPUT
fi
- name: Login to Docker Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand All @@ -69,8 +91,22 @@ jobs:
context: .
push: ${{ github.event_name != 'pull_request' && (github.ref_type == 'tag' || github.ref_name == 'main') }}
build-args: |
GVM_LIBS_VERSION=${{ steps.container-opts.outputs.gvm-libs-version }}
GVM_LIBS_VERSION=${{ steps.container-opts.outputs.gvm-libs-version }}
file: .docker/prod.Dockerfile
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
labels: ${{ needs.generate.outputs.labels }}

harbor:
name: Build and push to self-hosted harbor
needs: generate
uses: greenbone/workflows/.github/workflows/container-build-push-feed.yml@main
with:
build-docker-file: .docker/prod.Dockerfile
image-labels: ${{ needs.generate.outputs.labels }}
image-tags: |
type=raw,value=community
type=raw,value=latest
type=raw,value=${{ needs.generate.outputs.feed-info }}
image-url: community/pg-gvm
secrets: inherit
Loading