Skip to content

Commit

Permalink
Add: pushes greenbone-feed-sync image to harbor
Browse files Browse the repository at this point in the history
  • Loading branch information
Balou9 authored Aug 28, 2024
1 parent 71aa0c5 commit 354f389
Showing 1 changed file with 59 additions and 12 deletions.
71 changes: 59 additions & 12 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,59 @@ on:
workflow_dispatch:

jobs:
images:
name: Build images
runs-on: ubuntu-latest

generate:
name: generate greenbone-feed-sync 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
- name: Login to Dockerhub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
- name: Determine Feed Info
id: feed-info
run: |
echo "feed-version=$(date +"%Y%m%d%H%M")" >> $GITHUB_OUTPUT
- name: upload greenbone-feed-sync archive
uses: actions/upload-artifact@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
name: greenbone-feed-sync
path: .
- 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.documentation=https://greenbone.github.io/docs/
org.opencontainers.image.base.name=debian:stable-slim
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: Clean directory
run: rm -rf ${{ matrix.FEED_TYPE }}/*
- uses: actions/download-artifact@v4
with:
name: greenbone-feed-sync
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ vars.IMAGE_REGISTRY }}
username: ${{ secrets.GREENBONE_BOT }}
password: ${{ secrets.GREENBONE_BOT_PACKAGES_WRITE_TOKEN }}
- name: Setup additional container meta information
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
# create container tag for git tags
type=ref,event=tag
Expand All @@ -46,4 +77,20 @@ jobs:
file: .docker/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:
artifact-name: greenbone-feed-sync
artifact-path: community
build-context: community
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/greenbone-feed-sync
secrets: inherit

0 comments on commit 354f389

Please sign in to comment.