Skip to content

Commit 1506f3c

Browse files
authored
Merge pull request #255 from fluxcd/v2
Introduce ArtifactGenerator API
2 parents 5c0015b + d995333 commit 1506f3c

File tree

67 files changed

+8369
-503
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+8369
-503
lines changed

.github/dependabot.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ updates:
44
- package-ecosystem: "gomod"
55
directory: "/"
66
schedule:
7-
interval: "daily"
7+
interval: "monthly"
88
groups:
99
flux-deps:
1010
patterns:
@@ -22,15 +22,15 @@ updates:
2222
- package-ecosystem: "github-actions"
2323
directory: "/"
2424
schedule:
25-
interval: "daily"
25+
interval: "monthly"
2626
groups:
2727
ci:
2828
patterns:
2929
- "*"
3030
- package-ecosystem: "docker"
3131
directory: "/"
3232
schedule:
33-
interval: "daily"
33+
interval: "monthly"
3434
groups:
3535
docker:
3636
patterns:

.github/workflows/e2e.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: e2e
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
kind:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
15+
- name: Setup QEMU
16+
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
17+
- name: Setup Docker Buildx
18+
id: buildx
19+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
20+
- name: Setup Go
21+
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
22+
with:
23+
go-version: 1.25.x
24+
cache-dependency-path: |
25+
**/go.sum
26+
**/go.mod
27+
- name: Setup Kubernetes
28+
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
29+
with:
30+
version: v0.30.0
31+
cluster_name: kind
32+
- name: Setup Kustomize
33+
uses: fluxcd/pkg/actions/kustomize@main
34+
- name: Run tests
35+
run: make test
36+
- name: Check if working tree is dirty
37+
run: |
38+
if [[ $(git diff --stat) != '' ]]; then
39+
git --no-pager diff
40+
echo 'run make test and commit changes'
41+
exit 1
42+
fi
43+
- name: Build container image
44+
run: |
45+
make docker-build IMG=test/source-watcher:latest \
46+
BUILD_PLATFORMS=linux/amd64 \
47+
BUILD_ARGS=--load
48+
- name: Load test image
49+
run: kind load docker-image test/source-watcher:latest
50+
- name: Deploy controllers
51+
run: |
52+
make dev-deploy IMG=test/source-watcher:latest
53+
kubectl -n source-system rollout status deploy/source-controller --timeout=1m
54+
kubectl -n source-system rollout status deploy/source-watcher --timeout=1m
55+
- name: Source composition tests
56+
run: |
57+
kubectl apply -k config/testdata/composition
58+
kubectl -n composition wait artifactgenerator -l role=test --for=condition=ready --timeout=1m
59+
kubectl -n composition get artifactgenerators -o yaml
60+
kubectl -n composition get externalartifacts -o yaml
61+
- name: Source decomposition tests
62+
run: |
63+
kubectl apply -k config/testdata/decomposition
64+
kubectl -n decomposition wait artifactgenerator -l role=test --for=condition=ready --timeout=1m
65+
kubectl -n decomposition get artifactgenerators -o yaml
66+
kubectl -n decomposition get externalartifacts -o yaml
67+
- name: Logs
68+
if: always()
69+
run: |
70+
kubectl -n source-system logs deploy/source-controller
71+
kubectl -n source-system logs deploy/source-watcher

.github/workflows/release.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
- name: Setup Go
4545
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
4646
with:
47-
go-version: 1.24.x
47+
go-version: 1.25.x
4848
cache-dependency-path: |
4949
**/go.sum
5050
**/go.mod
@@ -91,6 +91,12 @@ jobs:
9191
run: |
9292
cosign sign --yes fluxcd/${{ env.CONTROLLER }}:${{ steps.prep.outputs.version }}
9393
cosign sign --yes ghcr.io/fluxcd/${{ env.CONTROLLER }}:${{ steps.prep.outputs.version }}
94+
- name: Generate release artifacts
95+
if: startsWith(github.ref, 'refs/tags/v')
96+
run: |
97+
mkdir -p config/release
98+
kustomize build ./config/crd > ./config/release/${{ env.CONTROLLER }}.crds.yaml
99+
kustomize build ./config/manager > ./config/release/${{ env.CONTROLLER }}.deployment.yaml
94100
- name: GoReleaser publish signed SBOM
95101
id: run-goreleaser
96102
if: startsWith(github.ref, 'refs/tags/v')

.github/workflows/test.yaml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,12 @@
1515
bin/
1616
testbin/
1717
build/
18+
19+
# Test manifests generated at build time
20+
config/crd/bases/ocirepositories.yaml
21+
config/crd/bases/gitrepositories.yaml
22+
config/crd/bases/buckets.yaml
23+
config/crd/bases/externalartifacts.yaml
24+
25+
# Release manifests generated at build time
26+
config/release/

.goreleaser.yaml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ builds:
44
- skip: true
55

66
release:
7+
extra_files:
8+
- glob: config/release/*.yaml
79
prerelease: auto
810
footer: |
911
## Container images
@@ -20,29 +22,32 @@ changelog:
2022
use: github-native
2123

2224
checksum:
23-
name_template: 'checksums.txt'
25+
extra_files:
26+
- glob: config/release/*.yaml
2427

2528
source:
2629
enabled: true
30+
name_template: "{{ .ProjectName }}_{{ .Version }}_source_code"
2731

2832
sboms:
29-
- artifacts: archive
3033
- id: source
3134
artifacts: source
35+
documents:
36+
- "{{ .ProjectName }}_{{ .Version }}_sbom.spdx.json"
3237

3338
# signs the checksum file
34-
# all files (including the sboms) are included in the checksum, so we don't need to sign each one if we don't want to
39+
# all files (including the sboms) are included in the checksum
3540
# https://goreleaser.com/customization/sign
3641
signs:
3742
- cmd: cosign
3843
env:
3944
- COSIGN_EXPERIMENTAL=1
40-
certificate: '${artifact}.pem'
45+
certificate: "${artifact}.pem"
4146
args:
4247
- sign-blob
4348
- "--yes"
44-
- '--output-certificate=${certificate}'
45-
- '--output-signature=${signature}'
46-
- '${artifact}'
49+
- "--output-certificate=${certificate}"
50+
- "--output-signature=${signature}"
51+
- "${artifact}"
4752
artifacts: checksum
4853
output: true

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ meeting](https://docs.google.com/document/d/1l_M0om0qUEN_NNiGgpqJ2tvsF2iioHkaARD
4040
### How to run the test suite
4141

4242
Prerequisites:
43-
* go >= 1.20
44-
* docker >= 20.10
45-
* kustomize >= 4.4
43+
* go >= 1.25
44+
* docker >= 28.3
45+
* kustomize >= 5.7
4646

4747
You can run the unit tests by simply doing
4848

Dockerfile

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,47 @@
1-
ARG GO_VERSION=1.24
1+
ARG GO_VERSION=1.25
22
ARG XX_VERSION=1.6.1
33

44
FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
55

6+
# Docker buildkit multi-arch build requires golang alpine
67
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS builder
78

89
# Copy the build utilities.
910
COPY --from=xx / /
1011

1112
ARG TARGETPLATFORM
1213

14+
# Configure workspace
1315
WORKDIR /workspace
1416

15-
# copy modules manifests
17+
# Copy api submodule
18+
COPY api/ api/
19+
20+
# Copy modules manifests
1621
COPY go.mod go.mod
1722
COPY go.sum go.sum
1823

19-
# cache modules
24+
# Cache modules
2025
RUN go mod download
2126

22-
# copy source code
23-
COPY main.go main.go
24-
COPY controllers/ controllers/
27+
# Copy source code
28+
COPY internal/ internal/
29+
COPY cmd/ cmd/
30+
31+
ARG TARGETPLATFORM
32+
ARG TARGETARCH
2533

26-
# build
34+
# build without specifing the arch
2735
ENV CGO_ENABLED=0
28-
RUN xx-go build -a -o source-watcher main.go
36+
RUN xx-go build -trimpath -a -o source-watcher cmd/main.go
2937

30-
FROM alpine:3.21
38+
FROM alpine:3.22
3139

32-
RUN apk add --no-cache ca-certificates tini
40+
ARG TARGETPLATFORM
41+
RUN apk --no-cache add ca-certificates \
42+
&& update-ca-certificates
3343

3444
COPY --from=builder /workspace/source-watcher /usr/local/bin/
3545

36-
RUN addgroup -S controller && adduser -S controller -G controller
37-
38-
USER controller
39-
40-
ENTRYPOINT [ "/sbin/tini", "--", "source-watcher" ]
46+
USER 65534:65534
47+
ENTRYPOINT [ "source-watcher" ]

0 commit comments

Comments
 (0)