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

Change: Add base-image-label as input, control image-tags by base-image-label. #111

Merged
merged 22 commits into from
Sep 25, 2024
Merged
Changes from 5 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2ff704c
Change: Add image-type as input, control image-tags by image-type.
Sep 23, 2024
94203dc
Update .github/workflows/container-build-push-2nd-gen.yml
robert-schardt Sep 23, 2024
9de213f
Update .github/workflows/container-build-push-2nd-gen.yml
robert-schardt Sep 23, 2024
6ff42a4
Change: Rename image-type to base-image-label
Sep 23, 2024
8a037e2
Change: Let create-multi-arch-manifest action create the tags
Sep 24, 2024
0388782
Change: Tmp tag defaults to github.ref_name
Sep 24, 2024
ca5f8bf
Fix: default doesn't work in combination with options
Sep 24, 2024
46eabb7
Fix: options attribute isn't supported anymore, switch to type: string
Sep 24, 2024
477c717
Fix: Remove required in combination with default
Sep 24, 2024
eb6e12d
Merge branch 'main' into DEVOPS-1230_rschardt
robert-schardt Sep 25, 2024
61cb4e7
Change: use meta action tags in manifest job
pascalholthaus Sep 25, 2024
8887fad
Update container-build-push-2nd-gen.yml
y0urself Sep 25, 2024
beeab6e
Update .github/workflows/container-build-push-2nd-gen.yml
robert-schardt Sep 25, 2024
9239184
Change: Only run pull latest tag test if base-image-label == 'stable'
Sep 25, 2024
6018c00
Add: image-flavor latest=false
Sep 25, 2024
743c5c0
Change: Switch back to v3 tag for container-multi-arch-manifest action
Sep 25, 2024
f9bf5e4
Change: Run notify only if not pull_request
Sep 25, 2024
c630962
Change: Add flavor latest=false to metadata-action
Sep 25, 2024
92a609f
Change: Add is-latest-tag true and not pull_request to test pull jobs
Sep 25, 2024
1ec8450
Change: add curly brackets
Sep 25, 2024
bc5566e
Change: Use job output to get is-latest-tag in test jobs
Sep 25, 2024
d5e6e57
Change: Switch from jobs. to needs.
Sep 25, 2024
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
60 changes: 33 additions & 27 deletions .github/workflows/container-build-push-2nd-gen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ on:
description: "Image labels."
required: true
type: string
base-image-label:
description: "Base image tag (Debian)."
required: true
default: "stable"
options:
- stable
- oldstable
- testing
image-url:
description: "Image url/name without registry."
required: true
Expand Down Expand Up @@ -112,18 +120,7 @@ jobs:
IMAGE_REGISTRY=${{ vars.IMAGE_REGISTRY }}
image-url: ${{ inputs.image-url }}
image-labels: ${{ inputs.image-labels }}
image-tags: |
type=semver,pattern={{version}},value=${{ inputs.ref-name }},enable=${{ github.event_name == 'workflow_dispatch' }}
type=semver,pattern={{version}},enable=${{ github.event_name != 'workflow_dispatch' }}
type=semver,pattern={{major}}.{{minor}},value=${{ inputs.ref-name }},enable=${{ github.event_name == 'workflow_dispatch' }}
type=semver,pattern={{major}}.{{minor}},enable=${{ github.event_name != 'workflow_dispatch' }}
type=semver,pattern={{major}},value=${{ inputs.ref-name }},enable=${{ github.event_name == 'workflow_dispatch' }}
type=semver,pattern={{major}},enable=${{ github.event_name != 'workflow_dispatch' }}
type=edge
type=ref,event=pr
type=raw,value=latest,enable=${{ steps.latest.outputs.is-latest-tag == 'true' }}
type=raw,value=stable,enable=${{ steps.latest.outputs.is-latest-tag == 'true' }}
type=raw,value=edge,enable=${{ (inputs.ref-name || github.ref_name) == 'main' }}
image-tags: type=raw,value=${{ inputs.ref_name }} # temporary tag that will be overwritten with the manifest upload
robert-schardt marked this conversation as resolved.
Show resolved Hide resolved
image-platforms: linux/amd64
registry: ${{ secrets.GREENBONE_REGISTRY }}
registry-username: ${{ secrets.GREENBONE_REGISTRY_USER }}
Expand Down Expand Up @@ -184,18 +181,7 @@ jobs:
IMAGE_REGISTRY=${{ vars.IMAGE_REGISTRY }}
image-url: ${{ inputs.image-url }}
image-labels: ${{ inputs.image-labels }}
image-tags: |
type=semver,pattern={{version}},value=${{ inputs.ref-name }},enable=${{ github.event_name == 'workflow_dispatch' }}
type=semver,pattern={{version}},enable=${{ github.event_name != 'workflow_dispatch' }}
type=semver,pattern={{major}}.{{minor}},value=${{ inputs.ref-name }},enable=${{ github.event_name == 'workflow_dispatch' }}
type=semver,pattern={{major}}.{{minor}},enable=${{ github.event_name != 'workflow_dispatch' }}
type=semver,pattern={{major}},value=${{ inputs.ref-name }},enable=${{ github.event_name == 'workflow_dispatch' }}
type=semver,pattern={{major}},enable=${{ github.event_name != 'workflow_dispatch' }}
type=edge
type=ref,event=pr
type=raw,value=latest,enable=${{ steps.latest.outputs.is-latest-tag == 'true' }}
type=raw,value=stable,enable=${{ steps.latest.outputs.is-latest-tag == 'true' }}
type=raw,value=edge,enable=${{ (inputs.ref-name || github.ref_name) == 'main' }}
image-tags: type=raw,value=${{ inputs.ref_name }} # temporary tag that will be overwritten with the manifest upload
image-platforms: linux/arm64
registry: ${{ secrets.GREENBONE_REGISTRY }}
registry-username: ${{ secrets.GREENBONE_REGISTRY_USER }}
Expand All @@ -211,6 +197,28 @@ jobs:
- build-amd64
- build-arm64
steps:
- name: Generate Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ inputs.image-url }}
robert-schardt marked this conversation as resolved.
Show resolved Hide resolved
tags: |
type=semver,pattern={{version}},value=${{ inputs.ref-name }},enable=${{ github.event_name == 'workflow_dispatch' }}
type=semver,pattern={{version}},enable=${{ github.event_name != 'workflow_dispatch' }}
type=semver,pattern={{major}}.{{minor}},value=${{ inputs.ref-name }},enable=${{ github.event_name == 'workflow_dispatch' }}
type=semver,pattern={{major}}.{{minor}},enable=${{ github.event_name != 'workflow_dispatch' }}
type=semver,pattern={{major}},value=${{ inputs.ref-name }},enable=${{ github.event_name == 'workflow_dispatch' }}
type=semver,pattern={{major}},enable=${{ github.event_name != 'workflow_dispatch' }}
type=edge
type=ref,event=pr
type=raw,value=latest,enable=${{ (steps.latest.outputs.is-latest-tag == 'true') && (inputs.base-image-label == 'stable') }}
type=raw,value=stable,enable=${{ (steps.latest.outputs.is-latest-tag == 'true') && (inputs.base-image-label == 'stable') }}
type=raw,value=edge,enable=${{ ((inputs.ref-name || github.ref_name) == 'main') && (inputs.base-image-label == 'stable') }}
type=raw,value=oldstable,enable=${{ (steps.latest.outputs.is-latest-tag == 'true') && (inputs.base-image-label == 'oldstable') }}
type=raw,value=oldstable-edge,enable=${{ ((inputs.ref-name || github.ref_name) == 'main') && (inputs.base-image-label == 'oldstable') }}
type=raw,value=testing,enable=${{ (steps.latest.outputs.is-latest-tag == 'true') && (inputs.base-image-label == 'testing') }}
type=raw,value=testing-edge,enable=${{ ((inputs.ref-name || github.ref_name) == 'main') && (inputs.base-image-label == 'testing') }}
robert-schardt marked this conversation as resolved.
Show resolved Hide resolved

- name: Create multi arch manifest
uses: greenbone/actions/container-multi-arch-manifest@v3
with:
Expand All @@ -220,9 +228,7 @@ jobs:
annotations: |
${{ needs.build-amd64.outputs.annotations }}
${{ needs.build-arm64.outputs.annotations }}
tags: |
${{ needs.build-amd64.outputs.tags }}
${{ needs.build-arm64.outputs.tags }}
tags: ${{ steps.meta.outputs.tags }}
digests: |
${{ needs.build-amd64.outputs.digest }}
${{ needs.build-arm64.outputs.digest }}
Expand Down