Skip to content

Commit 107be78

Browse files
authored
Merge pull request #1962 from kube-logging/feat/move-in-config-reloader
feat: move in config-reloaders
2 parents 9ab3bc4 + 0855f79 commit 107be78

File tree

37 files changed

+1622
-434
lines changed

37 files changed

+1622
-434
lines changed

.github/workflows/artifacts.yaml

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878

7979
- name: Set up Cosign
8080
uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
81-
if: inputs.publish
81+
if: ${{ inputs.publish }}
8282

8383
- name: Set image name
8484
id: image-name
@@ -102,37 +102,28 @@ jobs:
102102
org.opencontainers.image.authors=Kube logging authors
103103
org.opencontainers.image.documentation=https://kube-logging.dev/docs/
104104
105-
# Multiple exporters are not supported yet
106-
# See https://github.com/moby/buildkit/pull/2760
107-
- name: Determine build output
108-
uses: haya14busa/action-cond@94f77f7a80cd666cb3155084e428254fea4281fd # v1.2.1
109-
id: build-output
110-
with:
111-
cond: ${{ inputs.publish }}
112-
if_true: type=image,push=true
113-
if_false: type=oci,dest=image.tar
114-
115105
- name: Login to GitHub Container Registry
116106
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
117107
with:
118108
registry: ghcr.io
119109
username: ${{ github.actor }}
120110
password: ${{ github.token }}
121-
if: inputs.publish
111+
if: ${{ inputs.publish }}
122112

123113
- name: Build and push image
124114
id: build
125115
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
126116
with:
127117
context: .
128-
platforms: linux/amd64,linux/arm64,linux/arm/v7
118+
platforms: linux/amd64,linux/arm64
129119
tags: ${{ steps.meta.outputs.tags }}
130120
labels: ${{ steps.meta.outputs.labels }}
131121
cache-from: type=gha
132122
cache-to: type=gha,mode=max
133-
build-args: GO_BUILD_FLAGS=-ldflags=-X=github.com/kube-logging/logging-operator/pkg/sdk/logging/api/v1beta1.Version=${{ inputs.version }}-full
134-
outputs: ${{ steps.build-output.outputs.value }},name=target,annotation-index.org.opencontainers.image.description=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.description'] }}
135-
# push: ${{ inputs.publish }}
123+
build-args: GO_BUILD_FLAGS=-ldflags=-X=github.com/kube-logging/logging-operator/pkg/sdk/logging/api/v1beta1.Version=${{ inputs.version }}
124+
outputs: |
125+
type=image,push=${{ inputs.publish }},name=target,annotation-index.org.opencontainers.image.description=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.description'] }}
126+
type=oci,dest=image.tar,name=target,annotation-index.org.opencontainers.image.description=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.description'] }}
136127
137128
- name: Sign image with GitHub OIDC Token
138129
if: ${{ inputs.publish && github.repository_owner == 'kube-logging' }} # Check if the workflow is called by the same GitHub organization
@@ -199,10 +190,6 @@ jobs:
199190
fi
200191
fi
201192

202-
- name: Fetch image
203-
run: skopeo --insecure-policy copy docker://${{ steps.image-name.outputs.value }}:${{ steps.meta.outputs.version }} oci-archive:image.tar
204-
if: inputs.publish
205-
206193
- name: Extract OCI tarball
207194
run: |
208195
mkdir -p image

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ jobs:
102102
uses: ./.github/workflows/dependency-images.yaml
103103
with:
104104
publish: ${{ github.event_name == 'push' }}
105-
image-types: "full"
105+
fluentd-image-types: "full"
106106
permissions:
107107
contents: read
108108
packages: write
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Config reloader
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
publish:
7+
description: Publish artifacts to the artifact store
8+
default: false
9+
required: false
10+
type: boolean
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
config-reloader-image:
17+
name: Config reloader image
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23+
24+
- name: Set up QEMU
25+
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
26+
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
29+
30+
- name: Set up Cosign
31+
uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
32+
if: ${{ inputs.publish }}
33+
34+
- name: Set image name
35+
id: image-name
36+
run: echo "value=ghcr.io/${{ github.repository }}/config-reloader" >> "$GITHUB_OUTPUT"
37+
38+
- name: Gather build metadata
39+
id: meta
40+
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
41+
with:
42+
images: ${{ steps.image-name.outputs.value }}
43+
flavor: |
44+
latest = false
45+
tags: |
46+
type=ref,event=branch
47+
type=ref,event=pr
48+
type=semver,pattern={{raw}}
49+
type=raw,value=latest,enable={{is_default_branch}}
50+
labels: |
51+
org.opencontainers.image.description=Config reloader image for the Logging operator.
52+
org.opencontainers.image.title=Logging operator Config reloader image
53+
org.opencontainers.image.authors=Kube logging authors
54+
org.opencontainers.image.documentation=https://kube-logging.dev/docs/
55+
56+
- name: Login to GitHub Container Registry
57+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
58+
with:
59+
registry: ghcr.io
60+
username: ${{ github.actor }}
61+
password: ${{ github.token }}
62+
if: ${{ inputs.publish }}
63+
64+
- name: Build and push config-reloader image
65+
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
66+
with:
67+
context: images/config-reloader
68+
platforms: linux/amd64,linux/arm64
69+
tags: ${{ steps.meta.outputs.tags }}
70+
labels: ${{ steps.meta.outputs.labels }}
71+
cache-from: type=gha
72+
cache-to: type=gha,mode=max
73+
outputs: |
74+
type=image,push=${{ inputs.publish }},name=target,annotation-index.org.opencontainers.image.description=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.description'] }}
75+
type=oci,dest=image.tar,name=target,annotation-index.org.opencontainers.image.description=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.description'] }}
76+
77+
- name: Sign image with GitHub OIDC Token
78+
if: ${{ inputs.publish && github.repository_owner == 'kube-logging' }} # Check if the workflow is called by the same GitHub organization
79+
env:
80+
DIGEST: ${{ steps.build.outputs.digest }}
81+
TAGS: ${{ steps.meta.outputs.tags }}
82+
run: |
83+
images=""
84+
for tag in ${TAGS[@]}; do
85+
images+="${tag}@${DIGEST} "
86+
done
87+
88+
cosign sign --yes --rekor-url "https://rekor.sigstore.dev/" ${images}
89+
90+
- name: Verify signed image with cosign
91+
if: ${{ inputs.publish && github.repository_owner == 'kube-logging' }} # Check if the workflow is called by the same GitHub organization
92+
env:
93+
DIGEST: ${{ steps.build.outputs.digest }}
94+
TAGS: ${{ steps.meta.outputs.tags }}
95+
run: |
96+
for tag in ${TAGS[@]}; do
97+
cosign verify "${tag}@${DIGEST}" \
98+
--rekor-url "https://rekor.sigstore.dev/" \
99+
--certificate-identity "https://github.com/${{ github.repository }}/.github/workflows/config-reloader-image.yaml@${{ github.ref }}" \
100+
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" | jq
101+
done
102+
103+
- name: Extract OCI tarball
104+
run: |
105+
mkdir -p image
106+
tar -xf image.tar -C image
107+
108+
- name: Run Trivy vulnerability scanner
109+
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # 0.29.0
110+
env:
111+
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db:2
112+
TRIVY_JAVA_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-java-db:1
113+
with:
114+
input: image
115+
format: sarif
116+
output: trivy-results.sarif
117+
118+
- name: Upload Trivy scan results as artifact
119+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
120+
with:
121+
name: "[${{ github.job }}] Trivy scan results"
122+
path: trivy-results.sarif
123+
retention-days: 5
124+
125+
- name: Upload Trivy scan results to GitHub Security tab
126+
uses: github/codeql-action/upload-sarif@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8
127+
with:
128+
sarif_file: trivy-results.sarif

0 commit comments

Comments
 (0)