Compare commits

..

163 Commits
v2.5.1 ... main

Author SHA1 Message Date
Matheus Pimenta a8e0ea495d
Merge pull request #5508 from fluxcd/azure-e2e
ci: Align azure e2e tests secret names with fluxcd/pkg
5 days ago
Matheus Pimenta 8fb1ccebfa
ci: Align azure e2e tests secret names with fluxcd/pkg
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
5 days ago
Matheus Pimenta 664423230d
Merge pull request #5507 from fluxcd/skip-rc-upd
Skip release candidates on updates
1 week ago
Matheus Pimenta 0c8cfcdc85
Skip release candidates on updates
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
1 week ago
Matheus Pimenta 89d4467a50
Merge pull request #5505 from hawkaii/history
Add `--show-history` flag to `debug  helmrelease`
1 week ago
Parthib Mukherjee bef6f36755 Add --show-history flag to debug helmrelease
Signed-off-by: Parthib Mukherjee <parthibmukherjee@gmail.com>
1 week ago
Stefan Prodan 6125991b78
Merge pull request #5292 from fluxcd/rfc-external-artifact
[RFC-0012] External Artifact API
1 week ago
Stefan Prodan 64bfa02db4
Add Artifact access restrictions to recommendations
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 weeks ago
Stefan Prodan 1e662e5ed9
Assign 0012 to RFC
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 weeks ago
Stefan Prodan df57392f48
Add Feature Gate
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 weeks ago
Stefan Prodan 19cd02e548
Add SDK for packaging and exposing artifacts
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 weeks ago
Stefan Prodan 8bc7822fe5
Add security considerations and recommendations
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 weeks ago
Stefan Prodan e97da26435
Add design details to `ExternalArtifact` RFC
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 weeks ago
Stefan Prodan 1a89fa419e
RFC External Artifact API
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 weeks ago
Stefan Prodan 7c0e70b9cc
Merge pull request #5321 from adri1197/rfcs-opentelemetry
[RFC-0011] OpenTelemetry Tracing
2 weeks ago
Adrian Fernandez De La Torre ed9ee95dbe [RFC-0011] - OpenTelemetry Tracing
Signed-off-by: Adrian Fernandez De La Torre <adri1197@gmail.com>
2 weeks ago
Matheus Pimenta 63a38ab228
Merge pull request #5414 from mohiuddin-khan-shiam/main
fix(events): respect `--all-namespaces` flag
2 weeks ago
S. M. Mohiuddin Khan Shiam c2a883e25a
fix(events): respect `--all-namespaces` flag
The `flux events` command always applied a namespace filter, even when `--all-namespaces` was set.
This produced incomplete results and confused users expecting cluster-wide events.

Changes made:
* Build `clientListOpts` dynamically.
* Omit `client.InNamespace(...)` when `eventArgs.allNamespaces` is true, ensuring no namespace constraint.

Impact:
`flux events --all-namespaces` now returns events from every namespace, restoring expected functionality without affecting other options.

Signed-off-by: S. M. Mohiuddin Khan Shiam <147746955+mohiuddin-khan-shiam@users.noreply.github.com>
2 weeks ago
Stefan Prodan 24ae50cfd5
Merge pull request #5501 from fluxcd/auto-gomaxprocs
Allow the Go runtime to dynamically set `GOMAXPROCS`
2 weeks ago
Stefan Prodan 0573138e38
Allow the Go runtime to dynamically set `GOMAXPROCS`
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 weeks ago
Stefan Prodan 2f14313646
Merge pull request #5500 from fluxcd/dependabot/github_actions/ci-fe119e88f8
build(deps): bump the ci group across 1 directory with 10 updates
2 weeks ago
dependabot[bot] e135336aae
build(deps): bump the ci group across 1 directory with 10 updates
Bumps the ci group with 10 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [actions/checkout](https://github.com/actions/checkout) | `4.2.2` | `5.0.0` |
| [korthout/backport-action](https://github.com/korthout/backport-action) | `3.2.1` | `3.3.0` |
| [fluxcd/pkg](https://github.com/fluxcd/pkg) | `1.19.0` | `1.20.0` |
| [google-github-actions/auth](https://github.com/google-github-actions/auth) | `2.1.10` | `3.0.0` |
| [google-github-actions/setup-gcloud](https://github.com/google-github-actions/setup-gcloud) | `2.1.4` | `3.0.1` |
| [docker/login-action](https://github.com/docker/login-action) | `3.4.0` | `3.5.0` |
| [github/codeql-action](https://github.com/github/codeql-action) | `3.29.2` | `3.29.11` |
| [anchore/sbom-action](https://github.com/anchore/sbom-action) | `0.20.2` | `0.20.5` |
| [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) | `3.9.1` | `3.9.2` |
| [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) | `6.3.0` | `6.4.0` |



Updates `actions/checkout` from 4.2.2 to 5.0.0
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](11bd71901b...08c6903cd8)

Updates `korthout/backport-action` from 3.2.1 to 3.3.0
- [Release notes](https://github.com/korthout/backport-action/releases)
- [Commits](0193454f0c...ca4972adce)

Updates `fluxcd/pkg` from 1.19.0 to 1.20.0
- [Commits](9e79277372...7f090e9313)

Updates `google-github-actions/auth` from 2.1.10 to 3.0.0
- [Release notes](https://github.com/google-github-actions/auth/releases)
- [Changelog](https://github.com/google-github-actions/auth/blob/main/CHANGELOG.md)
- [Commits](ba79af0395...7c6bc770da)

Updates `google-github-actions/setup-gcloud` from 2.1.4 to 3.0.1
- [Release notes](https://github.com/google-github-actions/setup-gcloud/releases)
- [Changelog](https://github.com/google-github-actions/setup-gcloud/blob/main/CHANGELOG.md)
- [Commits](77e7a554d4...aa5489c893)

Updates `docker/login-action` from 3.4.0 to 3.5.0
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](74a5d14239...184bdaa072)

Updates `github/codeql-action` from 3.29.2 to 3.29.11
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](181d5eefc2...3c3833e0f8)

Updates `anchore/sbom-action` from 0.20.2 to 0.20.5
- [Release notes](https://github.com/anchore/sbom-action/releases)
- [Changelog](https://github.com/anchore/sbom-action/blob/main/RELEASE.md)
- [Commits](cee1b8e05a...da167eac91)

Updates `sigstore/cosign-installer` from 3.9.1 to 3.9.2
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](398d4b0eee...d58896d6a1)

Updates `goreleaser/goreleaser-action` from 6.3.0 to 6.4.0
- [Release notes](https://github.com/goreleaser/goreleaser-action/releases)
- [Commits](9c156ee8a1...e435ccd777)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 5.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: ci
- dependency-name: korthout/backport-action
  dependency-version: 3.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: fluxcd/pkg
  dependency-version: 1.20.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: google-github-actions/auth
  dependency-version: 3.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: ci
- dependency-name: google-github-actions/setup-gcloud
  dependency-version: 3.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: ci
- dependency-name: docker/login-action
  dependency-version: 3.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: github/codeql-action
  dependency-version: 3.29.11
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: anchore/sbom-action
  dependency-version: 0.20.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: sigstore/cosign-installer
  dependency-version: 3.9.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: goreleaser/goreleaser-action
  dependency-version: 6.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2 weeks ago
Stefan Prodan 64eeda58e6
Merge pull request #5499 from fluxcd/k8s-1.34
Update to Kubernetes v1.34.0 and Go 1.25.0
2 weeks ago
Stefan Prodan acdf523c54
Build with Go 1.25
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 weeks ago
Stefan Prodan e2abf8e358
Update `flux-cli` image to Alpine 3.22 and kubectl 1.34
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 weeks ago
Stefan Prodan d340f80d75
Update dependencies to Kubernetes v1.34.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 weeks ago
Stefan Prodan 76d36cb429
Merge pull request #5497 from fluxcd/conform-k8s-1.34
Run conformance tests for Kubernetes 1.34.0
2 weeks ago
Stefan Prodan a7fadcd344
Run conformance tests for Kubernetes 1.34.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 weeks ago
Stefan Prodan f19f8611f4
Merge pull request #5480 from fluxcd/rfc-0007-history
[RFC-0007] Implementation history update
1 month ago
Stefan Prodan 8cccb90f90
[RFC-0007] Implementation history update
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
1 month ago
Stefan Prodan 1408bb8294
Merge pull request #5473 from fluxcd/cmd-migrate
Implement `flux migrate` command
1 month ago
Stefan Prodan 45837d2d1b
Implement `flux migrate` command
The migrate command must be run before a Flux minor version upgrade.
The command migrates the Flux custom resources stored in Kubernetes etcd to their latest API version, ensuring the Flux components can continue to function correctly after the upgrade.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
1 month ago
Matheus Pimenta ccb9d12927
Merge pull request #5462 from cappyzawa/feat/runtime-secrets-migration
Migrate sourcesecret package to runtime/secrets APIs
2 months ago
cappyzawa 8b95a09319
Migrate sourcesecret package to runtime/secrets APIs
The sourcesecret package now uses pkg/runtime/secrets factory
functions instead of the previous monolithic approach. This
provides standardized secret generation with consistent
validation and error handling across all authentication types.

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
2 months ago
Stefan Prodan 8176d88801
Merge pull request #5440 from pinkavaj/pi-labels
manifests: Add `app.kubernetes.io/part-of: flux` label to controller pods
2 months ago
Jiří Pinkava 2f850743fa Add labels to Pod templates
Ensure also pods contain the relevant labels inherited from pared
Deployment object, this makes it easier to select and filter the pods
using the labels eg. when scraping for metrics.

Signed-off-by: Jiří Pinkava <j-pi@seznam.cz>
2 months ago
Stefan Prodan 4e53b6cb8d
Merge pull request #5460 from fluxcd/ci-token-update
ci: Use GITHUB_TOKEN for API calls in update workflow
2 months ago
Stefan Prodan 0bb2e3929f
ci: Use GITHUB_TOKEN for API calls in update workflow
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 months ago
Matheus Pimenta 82b38dfa68
Merge pull request #5455 from fluxcd/upgrade-deps
Upgrade fluxcd/pkg dependencies
2 months ago
Matheus Pimenta b3b404ed30
Upgrade fluxcd/pkg dependencies
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2 months ago
Stefan Prodan 45990633e6
Merge pull request #5435 from fluxcd/dependabot/github_actions/ci-641206964f
build(deps): bump the ci group across 1 directory with 7 updates
2 months ago
dependabot[bot] 97937c55bf
build(deps): bump the ci group across 1 directory with 7 updates
Bumps the ci group with 7 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [korthout/backport-action](https://github.com/korthout/backport-action) | `3.2.0` | `3.2.1` |
| [fluxcd/pkg](https://github.com/fluxcd/pkg) | `1.17.0` | `1.18.0` |
| [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | `3.10.0` | `3.11.1` |
| [ossf/scorecard-action](https://github.com/ossf/scorecard-action) | `2.4.1` | `2.4.2` |
| [github/codeql-action](https://github.com/github/codeql-action) | `3.28.17` | `3.29.2` |
| [anchore/sbom-action](https://github.com/anchore/sbom-action) | `0.19.0` | `0.20.1` |
| [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) | `3.8.2` | `3.9.1` |



Updates `korthout/backport-action` from 3.2.0 to 3.2.1
- [Release notes](https://github.com/korthout/backport-action/releases)
- [Commits](436145e922...0193454f0c)

Updates `fluxcd/pkg` from 1.17.0 to 1.18.0
- [Commits](7e9c75bbb6...3d6f759b76)

Updates `docker/setup-buildx-action` from 3.10.0 to 3.11.1
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](b5ca514318...e468171a9d)

Updates `ossf/scorecard-action` from 2.4.1 to 2.4.2
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](f49aabe0b5...05b42c6244)

Updates `github/codeql-action` from 3.28.17 to 3.29.2
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](60168efe1c...181d5eefc2)

Updates `anchore/sbom-action` from 0.19.0 to 0.20.1
- [Release notes](https://github.com/anchore/sbom-action/releases)
- [Changelog](https://github.com/anchore/sbom-action/blob/main/RELEASE.md)
- [Commits](9f73021414...9246b90769)

Updates `sigstore/cosign-installer` from 3.8.2 to 3.9.1
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](3454372f43...398d4b0eee)

---
updated-dependencies:
- dependency-name: korthout/backport-action
  dependency-version: 3.2.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: fluxcd/pkg
  dependency-version: 1.18.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: docker/setup-buildx-action
  dependency-version: 3.11.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: ossf/scorecard-action
  dependency-version: 2.4.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: github/codeql-action
  dependency-version: 3.29.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: anchore/sbom-action
  dependency-version: 0.20.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: sigstore/cosign-installer
  dependency-version: 3.9.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
2 months ago
Stefan Prodan f79c44ee0a
Merge pull request #5453 from fluxcd/k8s-1.33.2
Update dependencies to Kubernetes 1.33.2
2 months ago
Stefan Prodan 16eb212609
Update dependencies to Kubernetes 1.33.2
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 months ago
Stefan Prodan 5da5186b3b
Merge pull request #5451 from dgunzy/bump-kustomize-1.18.1
Fix `flux diff kustomization` ignore patterns
2 months ago
Daniel Guns 158618e632 Bump pkg/kustomize 1.18.1
Fixes #4921

Signed-off-by: Daniel Guns <danbguns@gmail.com>
2 months ago
Matheus Pimenta 81bd619abd
Merge pull request #5452 from fluxcd/rfc-0010-kubeconfig
[RFC-0010] Add workload identity support for remote generic clusters
2 months ago
Matheus Pimenta d2aa9fb996
[RFC-0010] Add workload identity support for remote generic clusters
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
2 months ago
Stefan Prodan 315dad8682
Merge pull request #5449 from fluxcd/fix-push-insecure
Fix `flux push artifact` for insecure registries
2 months ago
Stefan Prodan 600ec37524
Fix `flux push artifact` for insecure registries
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2 months ago
Matheus Pimenta 1af7e08f07
Merge pull request #5443 from fluxcd/update-components
Update toolkit components
2 months ago
fluxcdbot 61a19cac84 Update toolkit components
- kustomize-controller to v1.6.1
  https://github.com/fluxcd/kustomize-controller/blob/v1.6.1/CHANGELOG.md

Signed-off-by: GitHub <noreply@github.com>
2 months ago
Matheus Pimenta fa8ef5b9d1
Merge pull request #5434 from fluxcd/rfc-0010-kubeconfig
[RFC-0010] Add workload identity support for remote clusters
2 months ago
Matheus Pimenta eb5904fb9d
[RFC-0010] Add workload identity support for remote clusters
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
3 months ago
Matheus Pimenta fda72a014c
Merge pull request #5431 from dgunzy/bump-ssa-v0.49.0
Bump pkg/ssa to v0.49.0 for CABundle validation fix
3 months ago
Daniel Guns f4d6934a6f
Bump pkg/ssa to v0.49.0 for CABundle validation fix
Includes fix for #800: Remove CABundle from CRDs if cert is invalid

Signed-off-by: Daniel Guns <danbguns@gmail.com>
3 months ago
Stefan Prodan 545b338004
Merge pull request #5426 from fluxcd/update-components
Update toolkit components
3 months ago
Matheus Pimenta a8425f50bd
Fix: Prioritize sha2-512 and sha2-256 for ssh-rsa host keys
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
3 months ago
fluxcdbot 24bf751d4d Update toolkit components
- source-controller to v1.6.2
  https://github.com/fluxcd/source-controller/blob/v1.6.2/CHANGELOG.md
- image-automation-controller to v0.41.2
  https://github.com/fluxcd/image-automation-controller/blob/v0.41.2/CHANGELOG.md

Signed-off-by: GitHub <noreply@github.com>
3 months ago
Matheus Pimenta cf157ad8a3
Merge pull request #5421 from dgunzy/promote-image-commands-stable
Promote image CLI commands to stable
3 months ago
Daniel Guns 5a4bc9410b
Promote image CLI commands to stable
Remove experimental status from flux image commands in preparation
for GA release of image automation APIs.

Partial fix for #5411

Signed-off-by: Daniel Guns <danbguns@gmail.com>
3 months ago
Matheus Pimenta de594183bd
Merge pull request #5418 from cappyzawa/cleanup-auth-error-handling
refactor: cleanup GetArtifactRegistryCredentials error handling
3 months ago
cappyzawa 4c343893c5
refactor: cleanup GetArtifactRegistryCredentials error handling
Update fluxcd/pkg/auth to v0.18.0 and simplify error handling for
GetArtifactRegistryCredentials() following the improvements made in
the library.

Similar to fluxcd/image-reflector-controller#786, this removes
unnecessary nil checks as the function now returns errors directly
for unsupported providers.

- Replace authentication code in push_artifact.go with loginWithProvider()
- Remove unnecessary authenticator nil check in oci.go
- Remove unused imports (errors, auth packages)

Signed-off-by: cappyzawa <cappyzawa@gmail.com>
3 months ago
Matheus Pimenta 8ae0aaa46c
Merge pull request #5409 from fluxcd/update-components
Update toolkit components
3 months ago
fluxcdbot 6b3a1134bd Update toolkit components
- source-controller to v1.6.1
  https://github.com/fluxcd/source-controller/blob/v1.6.1/CHANGELOG.md
- image-reflector-controller to v0.35.2
  https://github.com/fluxcd/image-reflector-controller/blob/v0.35.2/CHANGELOG.md
- image-automation-controller to v0.41.1
  https://github.com/fluxcd/image-automation-controller/blob/v0.41.1/CHANGELOG.md

Signed-off-by: GitHub <noreply@github.com>
3 months ago
Stefan Prodan 40a9b495b2
Merge pull request #5402 from reiSh6phoo9o/feat/configurable_serviceaccountname
Make service-account name configurable in `flux create tenant`
3 months ago
Stefan Bickel 1d34e5355b Make golden tests pass
Signed-off-by: Stefan Bickel <stefan.bickel@cornelsen.de>
3 months ago
Stefan Bickel 00d0e1af25 Add tests and golden files for create tenant
Signed-off-by: Stefan Bickel <stefan.bickel@cornelsen.de>
3 months ago
Stefan Bickel 9f29702f54 Add cli arg --with-service-account
Signed-off-by: Stefan Bickel <stefan.bickel@cornelsen.de>
3 months ago
Stefan Prodan 7626cd0c86
Merge pull request #5407 from cappyzawa/refactor-deprecated-ssa-func
refactor: Use `normalize.UnstructuredList` instead of `ssa.SetNativeKindsDefaults`
3 months ago
cappyzawa 5291902fd7
Use normalize.UnstructuredList instead of ssa.SetNativeKindsDefaults
Signed-off-by: cappyzawa <cappyzawa@gmail.com>
3 months ago
Matheus Pimenta 1757d964c0
Merge pull request #5404 from fluxcd/fix-host-keys
Fix `knownhosts key mismatch` regression bug
3 months ago
Matheus Pimenta 999f61c02e
Upgrade dependencies
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
3 months ago
Matheus Pimenta 5eb43e4566
Merge pull request #5390 from fluxcd/azure-cli-auth
fix: Allow Azure CLI calls in `flux push artifact --provider azure` on DevOps runners
3 months ago
Matheus Pimenta ec3804cc6f
Introduce support for shelling out to Azure binaries in authentication
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
3 months ago
Matheus Pimenta 4c3aed9faf
Merge pull request #5389 from ba-work/add-sparse-checkout
Add sparse checkout to cli
3 months ago
Brock Alberry 06e3047a2f add sparse checkout to cli
Signed-off-by: Brock Alberry <brock.alberry@cse-cst.gc.ca>
3 months ago
Matheus Pimenta 99e6791f4b
Merge pull request #5347 from fluxcd/remove-manifests
Remove credentials sync manifests
3 months ago
Matheus Pimenta 9cad95dda5
Remove credentials sync manifests
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
3 months ago
Matheus Pimenta 76c584e751
Merge pull request #5388 from JIbald/typo
correct small typo
3 months ago
Johannes Ibald cd4244ae65 correct small typo
Signed-off-by: Johannes Ibald <johannes.ibald@etes.de>
3 months ago
Stefan Prodan 1d6137d39d
Merge pull request #5383 from fluxcd/test-image-automation-digest
Add digest pinning to image automation testing
3 months ago
Stefan Prodan be8acc0cfb
Add digest pinning to image automation testing
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
3 months ago
Stefan Prodan 2f5f40d593
Merge pull request #5381 from fluxcd/update-components
Update image-reflector-controller to v0.35.1
3 months ago
fluxcdbot 4172a8a7f9 Update toolkit components
- image-reflector-controller to v0.35.1
  https://github.com/fluxcd/image-reflector-controller/blob/v0.35.1/CHANGELOG.md

Signed-off-by: GitHub <noreply@github.com>
3 months ago
Stefan Prodan 4addf8a528
Merge pull request #5379 from fluxcd/backport-2.6-label
Add backport label for `v2.6.x`
3 months ago
Stefan Prodan 1df7697811
Add backport label for v2.6/x
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
3 months ago
Matheus Pimenta 4c66d37545
Merge pull request #5370 from fluxcd/update-components
Update toolkit components
4 months ago
fluxcdbot 481c3c6e1e Update toolkit components
- helm-controller to v1.3.0
  https://github.com/fluxcd/helm-controller/blob/v1.3.0/CHANGELOG.md
- kustomize-controller to v1.6.0
  https://github.com/fluxcd/kustomize-controller/blob/v1.6.0/CHANGELOG.md
- image-automation-controller to v0.41.0
  https://github.com/fluxcd/image-automation-controller/blob/v0.41.0/CHANGELOG.md

Signed-off-by: GitHub <noreply@github.com>
4 months ago
Stefan Prodan 1d1d96b489
Merge pull request #5373 from fluxcd/dependabot-up
Update dependabot config
4 months ago
Stefan Prodan 0b972771fd
Update dependabot config
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
4 months ago
Stefan Prodan 650732109e
Merge pull request #5371 from fluxcd/oci-ga
Update CLI to OCIRepository v1 (GA)
4 months ago
Stefan Prodan 79fed691ca
Update CLI to OCIRepository v1 (GA)
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
4 months ago
Matheus Pimenta b37ba736fa
Merge pull request #5345 from fluxcd/store-digests
Add --interval and --reflect-digest flags to flux create image policy
4 months ago
Matheus Pimenta 65766ff4fc
Add --interval and --reflect-digest flags to flux create image policy
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
4 months ago
Matheus Pimenta 19d9b87c62
Merge pull request #5369 from fluxcd/oci-commands
Promote artifact commands to stable
4 months ago
Matheus Pimenta d82ec5a211
Promote artifact commands to stable
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
4 months ago
Matheus Pimenta 5e5ffdbcc3
Merge pull request #5368 from fluxcd/update-components
Update toolkit components
4 months ago
Matheus Pimenta 13ec11da58
Fix image-reflector-controller tests after output change
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
4 months ago
fluxcdbot 2948d5e70f Update toolkit components
- source-controller to v1.6.0
  https://github.com/fluxcd/source-controller/blob/v1.6.0/CHANGELOG.md
- notification-controller to v1.6.0
  https://github.com/fluxcd/notification-controller/blob/v1.6.0/CHANGELOG.md
- image-reflector-controller to v0.35.0
  https://github.com/fluxcd/image-reflector-controller/blob/v0.35.0/CHANGELOG.md

Signed-off-by: GitHub <noreply@github.com>
4 months ago
Matheus Pimenta bb9a119456
Merge pull request #5366 from fluxcd/upgrade-deps
Update dependencies
4 months ago
Matheus Pimenta 22ac16f3a1
Update dependencies
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
4 months ago
Stefan Prodan 79a654d605
Merge pull request #5364 from fluxcd/conform-4.18.0-okd
Set Kubernetes 1.31 as min supported version
4 months ago
Stefan Prodan a421ce4266
Set Kubernetes 1.31 as min supported version
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
4 months ago
Stefan Prodan 4b42c9e746
Update conformance tests to supported versions
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
4 months ago
Stefan Prodan 5ffca1b157
Merge pull request #5357 from fluxcd/upgrade-deps
Upgrade fluxcd/pkg packages
4 months ago
Matheus Pimenta 0951061b5e
Upgrade fluxcd/pkg packages
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
4 months ago
leigh capili ad9d63ac52
Merge pull request #5356 from fluxcd/upgrade-deps
Upgrade fluxcd/pkg packages
4 months ago
Matheus Pimenta dccc658273
Upgrade fluxcd/pkg packages
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
4 months ago
Matheus Pimenta ef5389cd56
Merge pull request #5355 from fluxcd/rfc-0010-feature-gate
[RFC-0010] Update RFC feature gate behavior
4 months ago
Matheus Pimenta 3f63b3e864
[RFC-0010] Update RFC feature gate behavior
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
4 months ago
Matheus Pimenta 656d9d892d
Merge pull request #5354 from fluxcd/rfc-0010-feature-gate
[RFC-0010] Update RFC to include opt-in feature gate
4 months ago
Matheus Pimenta e979df122a
[RFC-0010] Update RFC to include opt-in feature gate
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
4 months ago
Stefan Prodan 8804b856ea
Merge pull request #5351 from fluxcd/fix-ci
Fix e2e workflow
4 months ago
Max Jonas Werner 3ba170e4d4
Fix e2e workflow
The `--short` flag has been removed from kubectl with 1.28.0
(49945dbfab/CHANGELOG/CHANGELOG-1.28.md (deprecation)).

Signed-off-by: Max Jonas Werner <max@coppersoft.com>
4 months ago
Max Jonas Werner 6150fe9942
Merge pull request #5349 from fluxcd/trace-hr-oci
Fix `flux trace` for HRs from `OCIRepository`s
4 months ago
Max Jonas Werner 3e80c5809e
Fix `flux trace` for HRs from `OCIRepository`s
Before:
```
$ flux -n default trace pod default-podinfo-585856f49c-4jl4m
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x40 pc=0x10618da70]

goroutine 1 [running]:
main.traceHelm({0x106dd7b28, 0x14000201490}, {0x12f34c0d8, 0x14000783100}, {{0x1400071e130?, 0x1061e7795?}, {0x1400071e109?, 0x1000d9c84?}}, 0x140006a6030)
	/home/runner/work/flux2/flux2/cmd/flux/trace.go:404 +0x2f0
main.traceObject({0x106dd7b28, 0x14000201490}, {0x12f34c0d8, 0x14000783100}, 0x140006a6030)
	/home/runner/work/flux2/flux2/cmd/flux/trace.go:134 +0x11c
main.traceObjects({0x106dd7b28, 0x14000201490}, {0x12f34c0d8, 0x14000783100}, {0x140006a6040, 0x1, 0x0?})
	/home/runner/work/flux2/flux2/cmd/flux/trace.go:112 +0x74
main.traceCmdRun(0x14000592800?, {0x140003aea80, 0x2, 0x4})
	/home/runner/work/flux2/flux2/cmd/flux/trace.go:107 +0x180
github.com/spf13/cobra.(*Command).execute(0x108341980, {0x140003aea40, 0x4, 0x4})
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:985 +0x834
github.com/spf13/cobra.(*Command).ExecuteC(0x108329280)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1041
main.main()
	/home/runner/work/flux2/flux2/cmd/flux/main.go:189 +0x78
```

After:

```
 $ ~/dev/flux/flux2/bin/flux -n default trace pod default-podinfo-585856f49c-4jl4m

Object:         Pod/default-podinfo-585856f49c-4jl4m
Namespace:      default
Status:         Managed by Flux
---
HelmRelease:    podinfo
Namespace:      flux-system
Target:         default
Revision:       6.8.0+2360bdf32ddc
Status:         Last reconciled at 2025-05-14 16:10:37 +0200 CEST
Message:        Helm install succeeded for release default/default-podinfo.v1 with chart podinfo@6.8.0+2360bdf32ddc
---
OCIRepository:   podinfo
Namespace:       flux-system
URL:             oci://ghcr.io/stefanprodan/charts/podinfo
Tag:             6.8.0
Revision:        6.8.0@sha256:2360bdf32ddc50c05f8e128118173343b0a012a338daf145b16e0da9c80081a4
Status:          Last reconciled at 2025-05-14 16:09:17 +0200 CEST
Message:         stored artifact for digest '6.8.0@sha256:2360bdf32ddc50c05f8e128118173343b0a012a338daf145b16e0da9c80081a4'
```

Signed-off-by: Max Jonas Werner <max@coppersoft.com>
4 months ago
Stefan Prodan 8928ac7d39
Merge pull request #5325 from fluxcd/dependabot/github_actions/ci-2efaba0903
build(deps): bump the ci group across 1 directory with 18 updates
4 months ago
dependabot[bot] 289645f142
build(deps): bump the ci group across 1 directory with 18 updates
Bumps the ci group with 18 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [korthout/backport-action](https://github.com/korthout/backport-action) | `3.1.0` | `3.2.0` |
| [actions/setup-go](https://github.com/actions/setup-go) | `5.3.0` | `5.4.0` |
| [fluxcd/pkg](https://github.com/fluxcd/pkg) | `1.2.0` | `1.3.0` |
| [replicatedhq/replicated-actions](https://github.com/replicatedhq/replicated-actions) | `1.17.0` | `1.19.0` |
| [Azure/login](https://github.com/azure/login) | `2.2.0` | `2.3.0` |
| [google-github-actions/auth](https://github.com/google-github-actions/auth) | `2.1.8` | `2.1.10` |
| [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) | `3.4.0` | `3.6.0` |
| [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | `3.9.0` | `3.10.0` |
| [docker/login-action](https://github.com/docker/login-action) | `3.3.0` | `3.4.0` |
| [ossf/scorecard-action](https://github.com/ossf/scorecard-action) | `2.4.0` | `2.4.1` |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `4.6.0` | `4.6.2` |
| [github/codeql-action](https://github.com/github/codeql-action) | `3.28.9` | `3.28.16` |
| [anchore/sbom-action](https://github.com/anchore/sbom-action) | `0.18.0` | `0.19.0` |
| [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) | `3.8.0` | `3.8.2` |
| [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) | `6.1.0` | `6.3.0` |
| [slsa-framework/slsa-github-generator](https://github.com/slsa-framework/slsa-github-generator) | `2.0.0` | `2.1.0` |
| [fossa-contrib/fossa-action](https://github.com/fossa-contrib/fossa-action) | `3.0.0` | `3.0.1` |
| [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) | `7.0.6` | `7.0.8` |



Updates `korthout/backport-action` from 3.1.0 to 3.2.0
- [Release notes](https://github.com/korthout/backport-action/releases)
- [Commits](be567af183...436145e922)

Updates `actions/setup-go` from 5.3.0 to 5.4.0
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](f111f3307d...0aaccfd150)

Updates `fluxcd/pkg` from 1.2.0 to 1.3.0
- [Commits](c964ce7b91...7e9c75bbb6)

Updates `replicatedhq/replicated-actions` from 1.17.0 to 1.19.0
- [Release notes](https://github.com/replicatedhq/replicated-actions/releases)
- [Commits](c98ab3b979...49b440dabd)

Updates `Azure/login` from 2.2.0 to 2.3.0
- [Release notes](https://github.com/azure/login/releases)
- [Commits](a65d910e8a...a457da9ea1)

Updates `google-github-actions/auth` from 2.1.8 to 2.1.10
- [Release notes](https://github.com/google-github-actions/auth/releases)
- [Changelog](https://github.com/google-github-actions/auth/blob/main/CHANGELOG.md)
- [Commits](71f986410d...ba79af0395)

Updates `docker/setup-qemu-action` from 3.4.0 to 3.6.0
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](4574d27a47...29109295f8)

Updates `docker/setup-buildx-action` from 3.9.0 to 3.10.0
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](f7ce87c1d6...b5ca514318)

Updates `docker/login-action` from 3.3.0 to 3.4.0
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](9780b0c442...74a5d14239)

Updates `ossf/scorecard-action` from 2.4.0 to 2.4.1
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](62b2cac7ed...f49aabe0b5)

Updates `actions/upload-artifact` from 4.6.0 to 4.6.2
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](65c4c4a1dd...ea165f8d65)

Updates `github/codeql-action` from 3.28.9 to 3.28.16
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](9e8d0789d4...28deaeda66)

Updates `anchore/sbom-action` from 0.18.0 to 0.19.0
- [Release notes](https://github.com/anchore/sbom-action/releases)
- [Changelog](https://github.com/anchore/sbom-action/blob/main/RELEASE.md)
- [Commits](f325610c9f...9f73021414)

Updates `sigstore/cosign-installer` from 3.8.0 to 3.8.2
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](c56c2d3e59...3454372f43)

Updates `goreleaser/goreleaser-action` from 6.1.0 to 6.3.0
- [Release notes](https://github.com/goreleaser/goreleaser-action/releases)
- [Commits](9ed2f89a66...9c156ee8a1)

Updates `slsa-framework/slsa-github-generator` from 2.0.0 to 2.1.0
- [Release notes](https://github.com/slsa-framework/slsa-github-generator/releases)
- [Changelog](https://github.com/slsa-framework/slsa-github-generator/blob/main/CHANGELOG.md)
- [Commits](https://github.com/slsa-framework/slsa-github-generator/compare/v2.0.0...v2.1.0)

Updates `fossa-contrib/fossa-action` from 3.0.0 to 3.0.1
- [Release notes](https://github.com/fossa-contrib/fossa-action/releases)
- [Changelog](https://github.com/fossa-contrib/fossa-action/blob/master/CHANGELOG.md)
- [Commits](cdc5065bcd...3d2ef181b1)

Updates `peter-evans/create-pull-request` from 7.0.6 to 7.0.8
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](67ccf781d6...271a8d0340)

---
updated-dependencies:
- dependency-name: korthout/backport-action
  dependency-version: 3.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: actions/setup-go
  dependency-version: 5.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: fluxcd/pkg
  dependency-version: 1.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: replicatedhq/replicated-actions
  dependency-version: 1.19.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: Azure/login
  dependency-version: 2.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: google-github-actions/auth
  dependency-version: 2.1.10
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: docker/setup-qemu-action
  dependency-version: 3.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: docker/setup-buildx-action
  dependency-version: 3.10.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: docker/login-action
  dependency-version: 3.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: ossf/scorecard-action
  dependency-version: 2.4.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: actions/upload-artifact
  dependency-version: 4.6.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: github/codeql-action
  dependency-version: 3.28.16
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: anchore/sbom-action
  dependency-version: 0.19.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: sigstore/cosign-installer
  dependency-version: 3.8.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: goreleaser/goreleaser-action
  dependency-version: 6.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: slsa-framework/slsa-github-generator
  dependency-version: 2.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: ci
- dependency-name: fossa-contrib/fossa-action
  dependency-version: 3.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
- dependency-name: peter-evans/create-pull-request
  dependency-version: 7.0.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: ci
...

Signed-off-by: dependabot[bot] <support@github.com>
4 months ago
Stefan Prodan 8d9cbe7693
Merge pull request #5338 from dgunzy/fix/get-command-error-formatting
Fix exit code handling in get command
4 months ago
Daniel Guns 392a33d425
Change error reporting in get.go from logger.Failure to fmt.Errorf to give non 0 exit code
Signed-off-by: Daniel Guns <danbguns@gmail.com>
4 months ago
Matheus Pimenta 6af448e037
Merge pull request #5333 from fluxcd/upgrade-deps
Upgrade fluxcd/pkg auth, oci, git and git/gogit
4 months ago
Matheus Pimenta ac66adc24c
Upgrade fluxcd/pkg auth, oci, git and git/gogit
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
4 months ago
Stefan Prodan 0a64800784
Merge pull request #5332 from fluxcd/rfc-0010
[RFC-0010] Add RBAC for creating service account tokens
4 months ago
Matheus Pimenta 941af6a648
[RFC-0010] Add RBAC for creating service account tokens
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
4 months ago
Matheus Pimenta a6b5013649
Merge pull request #5309 from fluxcd/update-rfc-0010
[RFC-0010] Remove EKS Pod Identity from the proposal
5 months ago
Matheus Pimenta c18ab38877
[RFC-0010] Remove EKS Pod Identity from the proposal
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
5 months ago
Stefan Prodan 8738712cfa
Merge pull request #5323 from fluxcd/k8s-1.33
Update to Kubernetes 1.33.0 and Go 1.24.0
5 months ago
Stefan Prodan 8816c5f7de
Update to Kubernetes 1.33.0 and Go 1.24.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
5 months ago
Stefan Prodan e9e15c5f7a
Merge pull request #5318 from fluxcd/conform-k8s-1.33.0
Run conformance tests for Kubernetes 1.33.0
5 months ago
Stefan Prodan 5b582917ec
Run conformance tests for Kubernetes 1.33.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
5 months ago
Stefan Prodan d9b66f6959
Merge pull request #5219 from niveau0/allow-recursive-dry-run
fix: allow recursive dry-run over local sources
5 months ago
niveau0 1b98e16940 fix: allow recursive dry-run over local sources
Signed-off-by: niveau0 <plingplong@t-online.de>
5 months ago
Stefan Prodan 0c73420ccf
Merge pull request #5302 from maboehm/fix-multiple-kustomizations
flux diff: Reset target struct before decoding
5 months ago
Marcel Boehm 8cb7188919 Reset target struct before decoding
Signed-off-by: Marcel Boehm <marcel.boehm@inovex.de>
5 months ago
Marcel Boehm 72a2866508 Add test for reading multiple Kustomizations in a single file
Signed-off-by: Marcel Boehm <marcel.boehm@inovex.de>
5 months ago
Matheus Pimenta 912718103c
Merge pull request #5209 from fluxcd/rfc-multi-tenant-workload-identity
[RFC-0010] Multi-Tenant Workload Identity
5 months ago
Matheus Pimenta a7e41df1e3
[RFC-0010] Multi-Tenant Workload Identity
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
5 months ago
Stefan Prodan c436708a13
Allow to pull/push artifacts to insecure registries without TLS
Allow to pull/push artifacts to insecure registries without TLS
5 months ago
Matthieu Mottet 3f4743037b Allow to pull/push artifacts without TLS
If applied, this commit will introduce a new `--insecure-repository`
flag to the following commands: `push artifacts`, `pull artifact`,
`diff artifact` and `list artifacts`. When used the flag will lead to
the option `crane.Insecure` being passed to the `crane` client allowing
the use of insecure repositories.

Signed-off-by: Matthieu Mottet <m.mottet@outlook.com>
5 months ago
Stefan Prodan 7b551b0d35
Merge pull request #5295 from fluxcd/dependabot/go_modules/helm.sh/helm/v3-3.17.3
build(deps): bump helm.sh/helm/v3 from 3.17.0 to 3.17.3
5 months ago
dependabot[bot] bb8a10bab8
build(deps): bump helm.sh/helm/v3 from 3.17.0 to 3.17.3
Bumps [helm.sh/helm/v3](https://github.com/helm/helm) from 3.17.0 to 3.17.3.
- [Release notes](https://github.com/helm/helm/releases)
- [Commits](https://github.com/helm/helm/compare/v3.17.0...v3.17.3)

---
updated-dependencies:
- dependency-name: helm.sh/helm/v3
  dependency-version: 3.17.3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
5 months ago
Matheus Pimenta 09af0becc5
Merge pull request #5287 from piontec/ignore-scorecard-for-backports
add: OSSF scorecard configuration file - ignore false-positive
5 months ago
Matheus Pimenta d84bff7d1b
Merge branch 'main' into ignore-scorecard-for-backports 5 months ago
Stefan Prodan a4c513487e
Merge pull request #5282 from piontec/use-gh-token
change: use the default ephemeral GITHUB_TOKEN instead of the static one
5 months ago
piontec 2046003714
Merge branch 'main' into use-gh-token 5 months ago
piontec f07ee355ea
Merge branch 'main' into ignore-scorecard-for-backports 5 months ago
Łukasz Piątkowski 5e02724e49
add: OSSF scorecard configuration file - ignore false-positive
Signed-off-by: Łukasz Piątkowski <piontec@gmail.com>
5 months ago
Matheus Pimenta e5926bcaad
Merge pull request #5284 from y-eight/main
ci: switch to goreleaser changelog generation
5 months ago
maximilian.schubert@telekom.de 355f2bc5f3
ci: sw to goreleaser changlog gen; rm dep
Signed-off-by: Maximilian Schubert <maximilian.schubert@telekom.de>
5 months ago
Łukasz Piątkowski 7e8e0ab772
change: use the default ephemeral GITHUB_TOKEN instead of the static GHCR_TOKEN
Signed-off-by: Łukasz Piątkowski <piontec@gmail.com>
5 months ago
Matheus Pimenta f0fecf7399
Merge pull request #5038 from laiminhtrung1997/remove-redundant-space
Remove redundant space.
6 months ago
laiminhtrung1997 54db4ffc8b Remove redundant space.
Signed-off-by: laiminhtrung1997 <68812829+laiminhtrung1997@users.noreply.github.com>
6 months ago
Matheus Pimenta 73fff7404f
Merge pull request #5227 from fluxcd/fix-debug-hr
Fix command debug hr not taking targetPath into account
6 months ago
Matheus Pimenta 24057743bb
Fix command debug hr not taking targetPath into account
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
6 months ago
Matheus Pimenta 04d87be082
Merge pull request #5215 from fluxcd/update-labels
Update backport labels for 2.5
7 months ago
Matheus Pimenta e7c6ebccc3 Update backport labels for 2.5
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
7 months ago
Matheus Pimenta 48382f885b
Merge pull request #5214 from fluxcd/update-components
Update kustomize-controller to v1.5.1
7 months ago
fluxcdbot 511d8346f2 Update toolkit components
- kustomize-controller to v1.5.1
  https://github.com/fluxcd/kustomize-controller/blob/v1.5.1/CHANGELOG.md

Signed-off-by: GitHub <noreply@github.com>
7 months ago
Matheus Pimenta f0e8e84ee0
Merge pull request #5141 from fluxcd/rfc-0008-implemented
Update RFC 0008 and RFC 0009 milestones
7 months ago
Matheus Pimenta c277fbf14e
Update RFC 0008 and RFC 0009 milestones
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
7 months ago
Matheus Pimenta 28570296a9
Merge pull request #5202 from NotAwar/patch-1
fix: correct name on github app secret
7 months ago
Awar Abdulkarim 39ec0cb594 fix: correct name on github app secret
Signed-off-by: Awar Abdulkarim <48431495+NotAwar@users.noreply.github.com>
7 months ago

@ -6,11 +6,9 @@ updates:
labels: ["area/ci", "dependencies"] labels: ["area/ci", "dependencies"]
groups: groups:
# Group all updates together, so that they are all applied in a single PR. # Group all updates together, so that they are all applied in a single PR.
# Grouped updates are currently in beta and is subject to change.
# xref: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#groups # xref: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#groups
ci: ci:
patterns: patterns:
- "*" - "*"
schedule: schedule:
# By default, this will be on a monday. interval: "monthly"
interval: "weekly"

@ -44,15 +44,12 @@
description: Feature request proposals in the RFC format description: Feature request proposals in the RFC format
color: '#D621C3' color: '#D621C3'
aliases: ['area/RFC'] aliases: ['area/RFC']
- name: backport:release/v2.0.x - name: backport:release/v2.4.x
description: To be backported to release/v2.0.x description: To be backported to release/v2.4.x
color: '#ffd700' color: '#ffd700'
- name: backport:release/v2.1.x - name: backport:release/v2.5.x
description: To be backported to release/v2.1.x description: To be backported to release/v2.5.x
color: '#ffd700' color: '#ffd700'
- name: backport:release/v2.2.x - name: backport:release/v2.6.x
description: To be backported to release/v2.2.x description: To be backported to release/v2.6.x
color: '#ffd700'
- name: backport:release/v2.3.x
description: To be backported to release/v2.3.x
color: '#ffd700' color: '#ffd700'

@ -24,6 +24,6 @@ jobs:
name: action on ${{ matrix.version }} name: action on ${{ matrix.version }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup flux - name: Setup flux
uses: ./action uses: ./action

@ -16,11 +16,11 @@ jobs:
if: github.event.pull_request.state == 'closed' && github.event.pull_request.merged && (github.event_name != 'labeled' || startsWith('backport:', github.event.label.name)) if: github.event.pull_request.state == 'closed' && github.event.pull_request.merged && (github.event_name != 'labeled' || startsWith('backport:', github.event.label.name))
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with: with:
ref: ${{ github.event.pull_request.head.sha }} ref: ${{ github.event.pull_request.head.sha }}
- name: Create backport PRs - name: Create backport PRs
uses: korthout/backport-action@be567af183754f6a5d831ae90f648954763f17f5 # v3.1.0 uses: korthout/backport-action@ca4972adce8039ff995e618f5fc02d1b7961f27a # v3.3.0
# xref: https://github.com/korthout/backport-action#inputs # xref: https://github.com/korthout/backport-action#inputs
with: with:
# Use token to allow workflows to be triggered for the created PR # Use token to allow workflows to be triggered for the created PR

@ -9,7 +9,7 @@ permissions:
contents: read contents: read
env: env:
GO_VERSION: 1.23.x GO_VERSION: 1.25.x
jobs: jobs:
conform-kubernetes: conform-kubernetes:
@ -19,13 +19,13 @@ jobs:
matrix: matrix:
# Keep this list up-to-date with https://endoflife.date/kubernetes # Keep this list up-to-date with https://endoflife.date/kubernetes
# Build images with https://github.com/fluxcd/flux-benchmark/actions/workflows/build-kind.yaml # Build images with https://github.com/fluxcd/flux-benchmark/actions/workflows/build-kind.yaml
KUBERNETES_VERSION: [1.30.9, 1.31.5, 1.32.1 ] KUBERNETES_VERSION: [1.31.5, 1.32.1, 1.33.0, 1.34.0]
fail-fast: false fail-fast: false
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Go - name: Setup Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with: with:
go-version: ${{ env.GO_VERSION }} go-version: ${{ env.GO_VERSION }}
cache-dependency-path: | cache-dependency-path: |
@ -42,7 +42,7 @@ jobs:
- name: Setup Kubernetes - name: Setup Kubernetes
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0 uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
with: with:
version: v0.22.0 version: v0.27.0
cluster_name: ${{ steps.prep.outputs.CLUSTER }} cluster_name: ${{ steps.prep.outputs.CLUSTER }}
node_image: ghcr.io/fluxcd/kindest/node:v${{ matrix.KUBERNETES_VERSION }}-arm64 node_image: ghcr.io/fluxcd/kindest/node:v${{ matrix.KUBERNETES_VERSION }}-arm64
- name: Run e2e tests - name: Run e2e tests
@ -76,13 +76,13 @@ jobs:
matrix: matrix:
# Keep this list up-to-date with https://endoflife.date/kubernetes # Keep this list up-to-date with https://endoflife.date/kubernetes
# Available versions can be found with "replicated cluster versions" # Available versions can be found with "replicated cluster versions"
K3S_VERSION: [ 1.30.9, 1.31.5, 1.32.1 ] K3S_VERSION: [ 1.31.8, 1.32.4, 1.33.0 ]
fail-fast: false fail-fast: false
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Go - name: Setup Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with: with:
go-version: ${{ env.GO_VERSION }} go-version: ${{ env.GO_VERSION }}
cache-dependency-path: | cache-dependency-path: |
@ -97,7 +97,7 @@ jobs:
KUBECONFIG_PATH="$(git rev-parse --show-toplevel)/bin/kubeconfig.yaml" KUBECONFIG_PATH="$(git rev-parse --show-toplevel)/bin/kubeconfig.yaml"
echo "kubeconfig-path=${KUBECONFIG_PATH}" >> $GITHUB_OUTPUT echo "kubeconfig-path=${KUBECONFIG_PATH}" >> $GITHUB_OUTPUT
- name: Setup Kustomize - name: Setup Kustomize
uses: fluxcd/pkg/actions/kustomize@c964ce7b91949ff4b5e3959db4f1d7bb2e029a49 # main uses: fluxcd/pkg/actions/kustomize@7f090e931301b18cbdc37d9a28b08f84ba1270fb # main
- name: Build - name: Build
run: make build-dev run: make build-dev
- name: Create repository - name: Create repository
@ -107,7 +107,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }}
- name: Create cluster - name: Create cluster
id: create-cluster id: create-cluster
uses: replicatedhq/replicated-actions/create-cluster@c98ab3b97925af5db9faf3f9676df7a9c6736985 # v1.17.0 uses: replicatedhq/replicated-actions/create-cluster@49b440dabd7e0e868cbbabda5cfc0d8332a279fa # v1.19.0
with: with:
api-token: ${{ secrets.REPLICATED_API_TOKEN }} api-token: ${{ secrets.REPLICATED_API_TOKEN }}
kubernetes-distribution: "k3s" kubernetes-distribution: "k3s"
@ -151,7 +151,7 @@ jobs:
kubectl delete ns flux-system --wait kubectl delete ns flux-system --wait
- name: Delete cluster - name: Delete cluster
if: ${{ always() }} if: ${{ always() }}
uses: replicatedhq/replicated-actions/remove-cluster@c98ab3b97925af5db9faf3f9676df7a9c6736985 # v1.17.0 uses: replicatedhq/replicated-actions/remove-cluster@49b440dabd7e0e868cbbabda5cfc0d8332a279fa # v1.19.0
continue-on-error: true continue-on-error: true
with: with:
api-token: ${{ secrets.REPLICATED_API_TOKEN }} api-token: ${{ secrets.REPLICATED_API_TOKEN }}
@ -169,13 +169,13 @@ jobs:
strategy: strategy:
matrix: matrix:
# Keep this list up-to-date with https://endoflife.date/red-hat-openshift # Keep this list up-to-date with https://endoflife.date/red-hat-openshift
OPENSHIFT_VERSION: [ 4.17.0-okd ] OPENSHIFT_VERSION: [ 4.18.0-okd ]
fail-fast: false fail-fast: false
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Go - name: Setup Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with: with:
go-version: ${{ env.GO_VERSION }} go-version: ${{ env.GO_VERSION }}
cache-dependency-path: | cache-dependency-path: |
@ -190,7 +190,7 @@ jobs:
KUBECONFIG_PATH="$(git rev-parse --show-toplevel)/bin/kubeconfig.yaml" KUBECONFIG_PATH="$(git rev-parse --show-toplevel)/bin/kubeconfig.yaml"
echo "kubeconfig-path=${KUBECONFIG_PATH}" >> $GITHUB_OUTPUT echo "kubeconfig-path=${KUBECONFIG_PATH}" >> $GITHUB_OUTPUT
- name: Setup Kustomize - name: Setup Kustomize
uses: fluxcd/pkg/actions/kustomize@c964ce7b91949ff4b5e3959db4f1d7bb2e029a49 # main uses: fluxcd/pkg/actions/kustomize@7f090e931301b18cbdc37d9a28b08f84ba1270fb # main
- name: Build - name: Build
run: make build-dev run: make build-dev
- name: Create repository - name: Create repository
@ -200,7 +200,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITPROVIDER_BOT_TOKEN }}
- name: Create cluster - name: Create cluster
id: create-cluster id: create-cluster
uses: replicatedhq/replicated-actions/create-cluster@c98ab3b97925af5db9faf3f9676df7a9c6736985 # v1.17.0 uses: replicatedhq/replicated-actions/create-cluster@49b440dabd7e0e868cbbabda5cfc0d8332a279fa # v1.19.0
with: with:
api-token: ${{ secrets.REPLICATED_API_TOKEN }} api-token: ${{ secrets.REPLICATED_API_TOKEN }}
kubernetes-distribution: "openshift" kubernetes-distribution: "openshift"
@ -242,7 +242,7 @@ jobs:
kubectl delete ns flux-system --wait kubectl delete ns flux-system --wait
- name: Delete cluster - name: Delete cluster
if: ${{ always() }} if: ${{ always() }}
uses: replicatedhq/replicated-actions/remove-cluster@c98ab3b97925af5db9faf3f9676df7a9c6736985 # v1.17.0 uses: replicatedhq/replicated-actions/remove-cluster@49b440dabd7e0e868cbbabda5cfc0d8332a279fa # v1.19.0
continue-on-error: true continue-on-error: true
with: with:
api-token: ${{ secrets.REPLICATED_API_TOKEN }} api-token: ${{ secrets.REPLICATED_API_TOKEN }}

@ -26,15 +26,14 @@ jobs:
defaults: defaults:
run: run:
working-directory: ./tests/integration working-directory: ./tests/integration
# This job is currently disabled. Remove the false check when Azure subscription is enabled. if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]'
if: false && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]'
steps: steps:
- name: CheckoutD - name: CheckoutD
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Go - name: Setup Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with: with:
go-version: 1.23.x go-version: 1.25.x
cache-dependency-path: tests/integration/go.sum cache-dependency-path: tests/integration/go.sum
- name: Setup Terraform - name: Setup Terraform
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2 uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
@ -49,9 +48,9 @@ jobs:
env: env:
SOPS_VER: 3.7.1 SOPS_VER: 3.7.1
- name: Authenticate to Azure - name: Authenticate to Azure
uses: Azure/login@a65d910e8af852a8061c627c456678983e180302 # v1.4.6 uses: Azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v1.4.6
with: with:
creds: '{"clientId":"${{ secrets.AZ_ARM_CLIENT_ID }}","clientSecret":"${{ secrets.AZ_ARM_CLIENT_SECRET }}","subscriptionId":"${{ secrets.AZ_ARM_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.AZ_ARM_TENANT_ID }}"}' creds: '{"clientId":"${{ secrets.ARM_CLIENT_ID }}","clientSecret":"${{ secrets.ARM_CLIENT_SECRET }}","subscriptionId":"${{ secrets.ARM_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.ARM_TENANT_ID }}"}'
- name: Set dynamic variables in .env - name: Set dynamic variables in .env
run: | run: |
cat > .env <<EOF cat > .env <<EOF
@ -61,33 +60,35 @@ jobs:
run: cat .env run: cat .env
- name: Run Azure e2e tests - name: Run Azure e2e tests
env: env:
ARM_CLIENT_ID: ${{ secrets.AZ_ARM_CLIENT_ID }} ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.AZ_ARM_CLIENT_SECRET }} ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
ARM_SUBSCRIPTION_ID: ${{ secrets.AZ_ARM_SUBSCRIPTION_ID }} ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.AZ_ARM_TENANT_ID }} ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
TF_VAR_azuredevops_org: ${{ secrets.TF_VAR_azuredevops_org }} TF_VAR_azuredevops_org: ${{ secrets.TF_VAR_azuredevops_org }}
TF_VAR_azuredevops_pat: ${{ secrets.TF_VAR_azuredevops_pat }} TF_VAR_azuredevops_pat: ${{ secrets.TF_VAR_azuredevops_pat }}
TF_VAR_location: ${{ vars.TF_VAR_azure_location }} TF_VAR_azure_location: ${{ vars.TF_VAR_azure_location }}
GITREPO_SSH_CONTENTS: ${{ secrets.AZURE_GITREPO_SSH_CONTENTS }} GITREPO_SSH_CONTENTS: ${{ secrets.GIT_SSH_IDENTITY }}
GITREPO_SSH_PUB_CONTENTS: ${{ secrets.AZURE_GITREPO_SSH_PUB_CONTENTS }} GITREPO_SSH_PUB_CONTENTS: ${{ secrets.GIT_SSH_IDENTITY_PUB }}
run: | run: |
source .env source .env
mkdir -p ./build/ssh mkdir -p ./build/ssh
touch ./build/ssh/key cat <<EOF > build/ssh/key
echo $GITREPO_SSH_CONTENTS | base64 -d > build/ssh/key $GITREPO_SSH_CONTENTS
EOF
export GITREPO_SSH_PATH=build/ssh/key export GITREPO_SSH_PATH=build/ssh/key
touch ./build/ssh/key.pub cat <<EOF > build/ssh/key.pub
echo $GITREPO_SSH_PUB_CONTENTS | base64 -d > ./build/ssh/key.pub $GITREPO_SSH_PUB_CONTENTS
EOF
export GITREPO_SSH_PUB_PATH=build/ssh/key.pub export GITREPO_SSH_PUB_PATH=build/ssh/key.pub
make test-azure make test-azure
- name: Ensure resource cleanup - name: Ensure resource cleanup
if: ${{ always() }} if: ${{ always() }}
env: env:
ARM_CLIENT_ID: ${{ secrets.AZ_ARM_CLIENT_ID }} ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.AZ_ARM_CLIENT_SECRET }} ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
ARM_SUBSCRIPTION_ID: ${{ secrets.AZ_ARM_SUBSCRIPTION_ID }} ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.AZ_ARM_TENANT_ID }} ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
TF_VAR_azuredevops_org: ${{ secrets.TF_VAR_azuredevops_org }} TF_VAR_azuredevops_org: ${{ secrets.TF_VAR_azuredevops_org }}
TF_VAR_azuredevops_pat: ${{ secrets.TF_VAR_azuredevops_pat }} TF_VAR_azuredevops_pat: ${{ secrets.TF_VAR_azuredevops_pat }}
TF_VAR_location: ${{ vars.TF_VAR_azure_location }} TF_VAR_azure_location: ${{ vars.TF_VAR_azure_location }}
run: source .env && make destroy-azure run: source .env && make destroy-azure

@ -17,11 +17,11 @@ jobs:
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]' if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]'
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Go - name: Setup Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with: with:
go-version: 1.23.x go-version: 1.25.x
cache-dependency-path: | cache-dependency-path: |
**/go.sum **/go.sum
**/go.mod **/go.mod
@ -32,12 +32,12 @@ jobs:
cluster_name: kind cluster_name: kind
# The versions below should target the newest Kubernetes version # The versions below should target the newest Kubernetes version
# Keep this up-to-date with https://endoflife.date/kubernetes # Keep this up-to-date with https://endoflife.date/kubernetes
node_image: ghcr.io/fluxcd/kindest/node:v1.31.0-amd64 node_image: ghcr.io/fluxcd/kindest/node:v1.33.0-amd64
kubectl_version: v1.31.0 kubectl_version: v1.32.0
- name: Setup Kustomize - name: Setup Kustomize
uses: fluxcd/pkg/actions/kustomize@c964ce7b91949ff4b5e3959db4f1d7bb2e029a49 # main uses: fluxcd/pkg/actions/kustomize@7f090e931301b18cbdc37d9a28b08f84ba1270fb # main
- name: Setup yq - name: Setup yq
uses: fluxcd/pkg/actions/yq@c964ce7b91949ff4b5e3959db4f1d7bb2e029a49 # main uses: fluxcd/pkg/actions/yq@7f090e931301b18cbdc37d9a28b08f84ba1270fb # main
- name: Build - name: Build
run: make build-dev run: make build-dev
- name: Set outputs - name: Set outputs
@ -107,6 +107,8 @@ jobs:
./bin/flux reconcile image repository podinfo ./bin/flux reconcile image repository podinfo
./bin/flux reconcile image update flux-system ./bin/flux reconcile image update flux-system
./bin/flux get images all ./bin/flux get images all
./bin/flux -n flux-system events --for ImageUpdateAutomation/flux-system
kubectl -n flux-system get -o yaml ImageUpdateAutomation flux-system
kubectl -n flux-system get -o yaml ImageUpdateAutomation flux-system | \ kubectl -n flux-system get -o yaml ImageUpdateAutomation flux-system | \
yq '.status.lastPushCommit | length > 1' | grep 'true' yq '.status.lastPushCommit | length > 1' | grep 'true'
env: env:

@ -29,11 +29,11 @@ jobs:
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]' if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]'
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Go - name: Setup Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with: with:
go-version: 1.23.x go-version: 1.25.x
cache-dependency-path: tests/integration/go.sum cache-dependency-path: tests/integration/go.sum
- name: Setup Terraform - name: Setup Terraform
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2 uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
@ -48,19 +48,19 @@ jobs:
env: env:
SOPS_VER: 3.7.1 SOPS_VER: 3.7.1
- name: Authenticate to Google Cloud - name: Authenticate to Google Cloud
uses: google-github-actions/auth@71f986410dfbc7added4569d411d040a91dc6935 # v2.1.8 uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0
id: 'auth' id: 'auth'
with: with:
credentials_json: '${{ secrets.FLUX2_E2E_GOOGLE_CREDENTIALS }}' credentials_json: '${{ secrets.FLUX2_E2E_GOOGLE_CREDENTIALS }}'
token_format: 'access_token' token_format: 'access_token'
- name: Setup gcloud - name: Setup gcloud
uses: google-github-actions/setup-gcloud@77e7a554d41e2ee56fc945c52dfd3f33d12def9a # v2.1.4 uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db # v3.0.1
- name: Setup QEMU - name: Setup QEMU
uses: docker/setup-qemu-action@4574d27a4764455b42196d70a065bc6853246a25 # v3.4.0 uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
- name: Setup Docker Buildx - name: Setup Docker Buildx
uses: docker/setup-buildx-action@f7ce87c1d6bead3e36075b2ce75da1f6cc28aaca # v3.9.0 uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Log into us-central1-docker.pkg.dev - name: Log into us-central1-docker.pkg.dev
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
with: with:
registry: us-central1-docker.pkg.dev registry: us-central1-docker.pkg.dev
username: oauth2accesstoken username: oauth2accesstoken

@ -23,11 +23,11 @@ jobs:
- 5000:5000 - 5000:5000
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Go - name: Setup Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with: with:
go-version: 1.23.x go-version: 1.25.x
cache-dependency-path: | cache-dependency-path: |
**/go.sum **/go.sum
**/go.mod **/go.mod
@ -40,13 +40,13 @@ jobs:
config: .github/kind/config.yaml # disable KIND-net config: .github/kind/config.yaml # disable KIND-net
# The versions below should target the oldest supported Kubernetes version # The versions below should target the oldest supported Kubernetes version
# Keep this up-to-date with https://endoflife.date/kubernetes # Keep this up-to-date with https://endoflife.date/kubernetes
node_image: ghcr.io/fluxcd/kindest/node:v1.30.9-amd64 node_image: ghcr.io/fluxcd/kindest/node:v1.31.5-amd64
kubectl_version: v1.30.9 kubectl_version: v1.32.0
- name: Setup Calico for network policy - name: Setup Calico for network policy
run: | run: |
kubectl apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.27.3/manifests/calico.yaml kubectl apply -f https://raw.githubusercontent.com/projectcalico/calico/v3.27.3/manifests/calico.yaml
- name: Setup Kustomize - name: Setup Kustomize
uses: fluxcd/pkg/actions/kustomize@c964ce7b91949ff4b5e3959db4f1d7bb2e029a49 # main uses: fluxcd/pkg/actions/kustomize@7f090e931301b18cbdc37d9a28b08f84ba1270fb # main
- name: Run tests - name: Run tests
run: make test run: make test
- name: Run e2e tests - name: Run e2e tests
@ -238,6 +238,9 @@ jobs:
- name: flux check - name: flux check
run: | run: |
./bin/flux check ./bin/flux check
- name: flux migrate
run: |
./bin/flux migrate
- name: flux version - name: flux version
run: | run: |
./bin/flux version ./bin/flux version
@ -247,7 +250,7 @@ jobs:
- name: Debug failure - name: Debug failure
if: failure() if: failure()
run: | run: |
kubectl version --client --short kubectl version --client
kubectl -n flux-system get all kubectl -n flux-system get all
kubectl -n flux-system describe pods kubectl -n flux-system describe pods
kubectl -n flux-system get kustomizations -oyaml kubectl -n flux-system get kustomizations -oyaml

@ -19,21 +19,21 @@ jobs:
actions: read actions: read
contents: read contents: read
steps: steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Run analysis - name: Run analysis
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0 uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
with: with:
results_file: results.sarif results_file: results.sarif
results_format: sarif results_format: sarif
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
publish_results: true publish_results: true
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with: with:
name: SARIF file name: SARIF file
path: results.sarif path: results.sarif
retention-days: 5 retention-days: 5
- name: Upload SARIF results - name: Upload SARIF results
uses: github/codeql-action/upload-sarif@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9 uses: github/codeql-action/upload-sarif@3c3833e0f8c1c83d449a7478aa59c036a9165498 # v3.29.11
with: with:
sarif_file: results.sarif sarif_file: results.sarif

@ -2,7 +2,7 @@ name: release
on: on:
push: push:
tags: [ 'v*' ] tags: ["v*"]
permissions: permissions:
contents: read contents: read
@ -20,33 +20,33 @@ jobs:
packages: write # needed for ghcr access packages: write # needed for ghcr access
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Unshallow - name: Unshallow
run: git fetch --prune --unshallow run: git fetch --prune --unshallow
- name: Setup Go - name: Setup Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with: with:
go-version: 1.23.x go-version: 1.25.x
cache: false cache: false
- name: Setup QEMU - name: Setup QEMU
uses: docker/setup-qemu-action@4574d27a4764455b42196d70a065bc6853246a25 # v3.4.0 uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
- name: Setup Docker Buildx - name: Setup Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@f7ce87c1d6bead3e36075b2ce75da1f6cc28aaca # v3.9.0 uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Setup Syft - name: Setup Syft
uses: anchore/sbom-action/download-syft@f325610c9f50a54015d37c8d16cb3b0e2c8f4de0 # v0.18.0 uses: anchore/sbom-action/download-syft@da167eac915b4e86f08b264dbdbc867b61be6f0c # v0.20.5
- name: Setup Cosign - name: Setup Cosign
uses: sigstore/cosign-installer@c56c2d3e59e4281cc41dea2217323ba5694b171e # v3.8.0 uses: sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # v3.9.2
- name: Setup Kustomize - name: Setup Kustomize
uses: fluxcd/pkg/actions/kustomize@c964ce7b91949ff4b5e3959db4f1d7bb2e029a49 # main uses: fluxcd/pkg/actions/kustomize@7f090e931301b18cbdc37d9a28b08f84ba1270fb # main
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
with: with:
registry: ghcr.io registry: ghcr.io
username: fluxcdbot username: fluxcdbot
password: ${{ secrets.GHCR_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
with: with:
username: fluxcdbot username: fluxcdbot
password: ${{ secrets.DOCKER_FLUXCD_PASSWORD }} password: ${{ secrets.DOCKER_FLUXCD_PASSWORD }}
@ -59,30 +59,19 @@ jobs:
run: | run: |
kustomize build manifests/crds > all-crds.yaml kustomize build manifests/crds > all-crds.yaml
- name: Generate OpenAPI JSON schemas from CRDs - name: Generate OpenAPI JSON schemas from CRDs
uses: fluxcd/pkg/actions/crdjsonschema@c964ce7b91949ff4b5e3959db4f1d7bb2e029a49 # main uses: fluxcd/pkg/actions/crdjsonschema@7f090e931301b18cbdc37d9a28b08f84ba1270fb # main
with: with:
crd: all-crds.yaml crd: all-crds.yaml
output: schemas output: schemas
- name: Archive the OpenAPI JSON schemas - name: Archive the OpenAPI JSON schemas
run: | run: |
tar -czvf ./output/crd-schemas.tar.gz -C schemas . tar -czvf ./output/crd-schemas.tar.gz -C schemas .
- name: Download release notes utility
env:
GH_REL_URL: https://github.com/buchanae/github-release-notes/releases/download/0.2.0/github-release-notes-linux-amd64-0.2.0.tar.gz
run: cd /tmp && curl -sSL ${GH_REL_URL} | tar xz && sudo mv github-release-notes /usr/local/bin/
- name: Generate release notes
run: |
NOTES="./output/notes.md"
echo '## CLI Changelog' > ${NOTES}
github-release-notes -org fluxcd -repo flux2 -since-latest-release -include-author >> ${NOTES}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser - name: Run GoReleaser
id: run-goreleaser id: run-goreleaser
uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0 uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
with: with:
version: latest version: latest
args: release --release-notes=output/notes.md --skip=validate args: release --skip=validate
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
@ -110,9 +99,9 @@ jobs:
id-token: write id-token: write
packages: write packages: write
steps: steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Kustomize - name: Setup Kustomize
uses: fluxcd/pkg/actions/kustomize@c964ce7b91949ff4b5e3959db4f1d7bb2e029a49 # main uses: fluxcd/pkg/actions/kustomize@7f090e931301b18cbdc37d9a28b08f84ba1270fb # main
- name: Setup Flux CLI - name: Setup Flux CLI
uses: ./action/ uses: ./action/
- name: Prepare - name: Prepare
@ -121,13 +110,13 @@ jobs:
VERSION=$(flux version --client | awk '{ print $NF }') VERSION=$(flux version --client | awk '{ print $NF }')
echo "version=${VERSION}" >> $GITHUB_OUTPUT echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Login to GHCR - name: Login to GHCR
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
with: with:
registry: ghcr.io registry: ghcr.io
username: fluxcdbot username: fluxcdbot
password: ${{ secrets.GHCR_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
with: with:
username: fluxcdbot username: fluxcdbot
password: ${{ secrets.DOCKER_FLUXCD_PASSWORD }} password: ${{ secrets.DOCKER_FLUXCD_PASSWORD }}
@ -155,7 +144,7 @@ jobs:
--path="./flux-system" \ --path="./flux-system" \
--source=${{ github.repositoryUrl }} \ --source=${{ github.repositoryUrl }} \
--revision="${{ github.ref_name }}@sha1:${{ github.sha }}" --revision="${{ github.ref_name }}@sha1:${{ github.sha }}"
- uses: sigstore/cosign-installer@c56c2d3e59e4281cc41dea2217323ba5694b171e # v3.8.0 - uses: sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # v3.9.2
- name: Sign manifests - name: Sign manifests
env: env:
COSIGN_EXPERIMENTAL: 1 COSIGN_EXPERIMENTAL: 1
@ -176,7 +165,7 @@ jobs:
actions: read # for detecting the Github Actions environment. actions: read # for detecting the Github Actions environment.
id-token: write # for creating OIDC tokens for signing. id-token: write # for creating OIDC tokens for signing.
contents: write # for uploading attestations to GitHub releases. contents: write # for uploading attestations to GitHub releases.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0 uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.1.0
with: with:
provenance-name: "provenance.intoto.jsonl" provenance-name: "provenance.intoto.jsonl"
base64-subjects: "${{ needs.release-flux-cli.outputs.hashes }}" base64-subjects: "${{ needs.release-flux-cli.outputs.hashes }}"
@ -188,7 +177,7 @@ jobs:
actions: read # for detecting the Github Actions environment. actions: read # for detecting the Github Actions environment.
id-token: write # for creating OIDC tokens for signing. id-token: write # for creating OIDC tokens for signing.
packages: write # for uploading attestations. packages: write # for uploading attestations.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.0.0 uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.1.0
with: with:
image: ${{ needs.release-flux-cli.outputs.image_url }} image: ${{ needs.release-flux-cli.outputs.image_url }}
digest: ${{ needs.release-flux-cli.outputs.image_digest }} digest: ${{ needs.release-flux-cli.outputs.image_digest }}
@ -202,10 +191,10 @@ jobs:
actions: read # for detecting the Github Actions environment. actions: read # for detecting the Github Actions environment.
id-token: write # for creating OIDC tokens for signing. id-token: write # for creating OIDC tokens for signing.
packages: write # for uploading attestations. packages: write # for uploading attestations.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.0.0 uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.1.0
with: with:
image: ghcr.io/${{ needs.release-flux-cli.outputs.image_url }} image: ghcr.io/${{ needs.release-flux-cli.outputs.image_url }}
digest: ${{ needs.release-flux-cli.outputs.image_digest }} digest: ${{ needs.release-flux-cli.outputs.image_digest }}
registry-username: fluxcdbot registry-username: fluxcdbot
secrets: secrets:
registry-password: ${{ secrets.GHCR_TOKEN }} registry-password: ${{ secrets.GITHUB_TOKEN }}

@ -17,47 +17,14 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]' if: github.actor != 'dependabot[bot]'
steps: steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Run FOSSA scan and upload build data - name: Run FOSSA scan and upload build data
uses: fossa-contrib/fossa-action@cdc5065bcdee31a32e47d4585df72d66e8e941c2 # v3.0.0 uses: fossa-contrib/fossa-action@3d2ef181b1820d6dcd1972f86a767d18167fa19b # v3.0.1
with: with:
# FOSSA Push-Only API Token # FOSSA Push-Only API Token
fossa-api-key: 5ee8bf422db1471e0bcf2bcb289185de fossa-api-key: 5ee8bf422db1471e0bcf2bcb289185de
github-token: ${{ github.token }} github-token: ${{ github.token }}
scan-snyk:
runs-on: ubuntu-latest
permissions:
security-events: write
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Kustomize
uses: fluxcd/pkg/actions/kustomize@c964ce7b91949ff4b5e3959db4f1d7bb2e029a49 # main
- name: Setup Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version-file: 'go.mod'
cache-dependency-path: |
**/go.sum
**/go.mod
- name: Download modules and build manifests
run: |
make tidy
make cmd/flux/.manifests.done
- uses: snyk/actions/setup@b98d498629f1c368650224d6d212bf7dfa89e4bf
- name: Run Snyk to check for vulnerabilities
continue-on-error: true
run: |
snyk test --all-projects --sarif-file-output=snyk.sarif
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
- name: Upload result to GitHub Code Scanning
continue-on-error: true
uses: github/codeql-action/upload-sarif@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9
with:
sarif_file: snyk.sarif
scan-codeql: scan-codeql:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
@ -65,22 +32,22 @@ jobs:
if: github.actor != 'dependabot[bot]' if: github.actor != 'dependabot[bot]'
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Go - name: Setup Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with: with:
go-version-file: 'go.mod' go-version-file: 'go.mod'
cache-dependency-path: | cache-dependency-path: |
**/go.sum **/go.sum
**/go.mod **/go.mod
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9 uses: github/codeql-action/init@3c3833e0f8c1c83d449a7478aa59c036a9165498 # v3.29.11
with: with:
languages: go languages: go
# xref: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs # xref: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# xref: https://codeql.github.com/codeql-query-help/go/ # xref: https://codeql.github.com/codeql-query-help/go/
queries: security-and-quality queries: security-and-quality
- name: Autobuild - name: Autobuild
uses: github/codeql-action/autobuild@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9 uses: github/codeql-action/autobuild@3c3833e0f8c1c83d449a7478aa59c036a9165498 # v3.29.11
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9 uses: github/codeql-action/analyze@3c3833e0f8c1c83d449a7478aa59c036a9165498 # v3.29.11

@ -17,7 +17,7 @@ jobs:
permissions: permissions:
issues: write issues: write
steps: steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: EndBug/label-sync@52074158190acb45f3077f9099fea818aa43f97a # v2.3.3 - uses: EndBug/label-sync@52074158190acb45f3077f9099fea818aa43f97a # v2.3.3
with: with:
# Configuration file # Configuration file

@ -18,21 +18,29 @@ jobs:
pull-requests: write pull-requests: write
steps: steps:
- name: Check out code - name: Check out code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Go - name: Setup Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with: with:
go-version: 1.23.x go-version: 1.25.x
cache-dependency-path: | cache-dependency-path: |
**/go.sum **/go.sum
**/go.mod **/go.mod
- name: Update component versions - name: Update component versions
id: update id: update
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
PR_BODY=$(mktemp) PR_BODY=$(mktemp)
bump_version() { bump_version() {
local LATEST_VERSION=$(curl -s https://api.github.com/repos/fluxcd/$1/releases | jq -r 'sort_by(.published_at) | .[-1] | .tag_name') local LATEST_VERSION=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/repos/fluxcd/$1/releases | jq -r 'sort_by(.published_at) | .[-1] | .tag_name')
if [[ "$LATEST_VERSION" == *"-rc"* ]]; then
echo "Skipping release candidate version for $1: $LATEST_VERSION"
return
fi
local CTRL_VERSION=$(sed -n "s/.*$1\/releases\/download\/\(.*\)\/.*/\1/p;n" manifests/bases/$1/kustomization.yaml) local CTRL_VERSION=$(sed -n "s/.*$1\/releases\/download\/\(.*\)\/.*/\1/p;n" manifests/bases/$1/kustomization.yaml)
local CRD_VERSION=$(sed -n "s/.*$1\/releases\/download\/\(.*\)\/.*/\1/p" manifests/crds/kustomization.yaml) local CRD_VERSION=$(sed -n "s/.*$1\/releases\/download\/\(.*\)\/.*/\1/p" manifests/crds/kustomization.yaml)
local MOD_VERSION=$(go list -m -f '{{ .Version }}' "github.com/fluxcd/$1/api") local MOD_VERSION=$(go list -m -f '{{ .Version }}' "github.com/fluxcd/$1/api")
@ -84,7 +92,7 @@ jobs:
- name: Create Pull Request - name: Create Pull Request
id: cpr id: cpr
uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6 uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
with: with:
token: ${{ secrets.BOT_GITHUB_TOKEN }} token: ${{ secrets.BOT_GITHUB_TOKEN }}
commit-message: | commit-message: |

@ -1,4 +1,6 @@
project_name: flux project_name: flux
changelog:
use: github-native
builds: builds:
- <<: &build_defaults - <<: &build_defaults
binary: flux binary: flux

@ -0,0 +1,5 @@
annotations:
- checks:
- dangerous-workflow
reasons:
- reason: not-applicable # This workflow does not run untrusted code, the bot will only backport a code if the a PR was approved and merged into main.

@ -67,8 +67,8 @@ for source changes.
Prerequisites: Prerequisites:
* go >= 1.20 * go >= 1.24
* kubectl >= 1.24 * kubectl >= 1.30
* kustomize >= 5.0 * kustomize >= 5.0
* coreutils (on Mac OS) * coreutils (on Mac OS)

@ -1,16 +1,16 @@
FROM alpine:3.21 AS builder FROM alpine:3.22 AS builder
RUN apk add --no-cache ca-certificates curl RUN apk add --no-cache ca-certificates curl
ARG ARCH=linux/amd64 ARG ARCH=linux/amd64
ARG KUBECTL_VER=1.32.2 ARG KUBECTL_VER=1.34.0
RUN curl -sL https://dl.k8s.io/release/v${KUBECTL_VER}/bin/${ARCH}/kubectl \ RUN curl -sL https://dl.k8s.io/release/v${KUBECTL_VER}/bin/${ARCH}/kubectl \
-o /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl -o /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl
RUN kubectl version --client=true RUN kubectl version --client=true
FROM alpine:3.21 AS flux-cli FROM alpine:3.22 AS flux-cli
RUN apk add --no-cache ca-certificates RUN apk add --no-cache ca-certificates

@ -17,8 +17,8 @@ rwildcard=$(foreach d,$(wildcard $(addsuffix *,$(1))),$(call rwildcard,$(d)/,$(2
all: test build all: test build
tidy: tidy:
go mod tidy -compat=1.23 go mod tidy -compat=1.25
cd tests/integration && go mod tidy -compat=1.23 cd tests/integration && go mod tidy -compat=1.25
fmt: fmt:
go fmt ./... go fmt ./...

@ -42,7 +42,7 @@ import (
var bootstrapGitLabCmd = &cobra.Command{ var bootstrapGitLabCmd = &cobra.Command{
Use: "gitlab", Use: "gitlab",
Short: "Deploy Flux on a cluster connected to a GitLab repository", Short: "Deploy Flux on a cluster connected to a GitLab repository",
Long: `The bootstrap gitlab command creates the GitLab repository if it doesn't exists and Long: `The bootstrap gitlab command creates the GitLab repository if it doesn't exist and
commits the Flux manifests to the specified branch. commits the Flux manifests to the specified branch.
Then it configures the target cluster to synchronize with that repository. Then it configures the target cluster to synchronize with that repository.
If the Flux components are present on the cluster, If the Flux components are present on the cluster,

@ -26,15 +26,15 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
oci "github.com/fluxcd/pkg/oci/client" "github.com/fluxcd/pkg/oci"
"github.com/fluxcd/pkg/sourceignore" "github.com/fluxcd/pkg/sourceignore"
) )
var buildArtifactCmd = &cobra.Command{ var buildArtifactCmd = &cobra.Command{
Use: "artifact", Use: "artifact",
Short: "Build artifact", Short: "Build artifact",
Long: withPreviewNote(`The build artifact command creates a tgz file with the manifests Long: `The build artifact command creates a tgz file with the manifests
from the given directory or a single manifest file.`), from the given directory or a single manifest file.`,
Example: ` # Build the given manifests directory into an artifact Example: ` # Build the given manifests directory into an artifact
flux build artifact --path ./path/to/local/manifests --output ./path/to/artifact.tgz flux build artifact --path ./path/to/local/manifests --output ./path/to/artifact.tgz

@ -169,6 +169,12 @@ spec:
resultFile: "./testdata/build-kustomization/podinfo-with-my-app-result.yaml", resultFile: "./testdata/build-kustomization/podinfo-with-my-app-result.yaml",
assertFunc: "assertGoldenTemplateFile", assertFunc: "assertGoldenTemplateFile",
}, },
{
name: "build with recursive in dry-run mode",
args: "build kustomization podinfo --kustomization-file " + tmpFile + " --path ./testdata/build-kustomization/podinfo-with-my-app --recursive --local-sources GitRepository/default/podinfo=./testdata/build-kustomization --dry-run",
resultFile: "./testdata/build-kustomization/podinfo-with-my-app-result.yaml",
assertFunc: "assertGoldenTemplateFile",
},
} }
tmpl := map[string]string{ tmpl := map[string]string{

@ -60,7 +60,7 @@ type checkFlags struct {
} }
var kubernetesConstraints = []string{ var kubernetesConstraints = []string{
">=1.30.0-0", ">=1.31.0-0",
} }
var checkArgs checkFlags var checkArgs checkFlags
@ -217,7 +217,7 @@ func componentsCheck(ctx context.Context, kubeClient client.Client) bool {
} }
} }
for _, c := range d.Spec.Template.Spec.Containers { for _, c := range d.Spec.Template.Spec.Containers {
logger.Actionf(c.Image) logger.Actionf("%s", c.Image)
} }
} }
} }
@ -238,7 +238,7 @@ func crdsCheck(ctx context.Context, kubeClient client.Client) bool {
for _, crd := range list.Items { for _, crd := range list.Items {
versions := crd.Status.StoredVersions versions := crd.Status.StoredVersions
if len(versions) > 0 { if len(versions) > 0 {
logger.Successf(crd.Name + "/" + versions[len(versions)-1]) logger.Successf("%s", crd.Name+"/"+versions[len(versions)-1])
} else { } else {
ok = false ok = false
logger.Failuref("no stored versions for %s", crd.Name) logger.Failuref("no stored versions for %s", crd.Name)

@ -37,7 +37,6 @@ import (
"github.com/fluxcd/pkg/apis/meta" "github.com/fluxcd/pkg/apis/meta"
"github.com/fluxcd/pkg/runtime/transform" "github.com/fluxcd/pkg/runtime/transform"
sourcev1 "github.com/fluxcd/source-controller/api/v1" sourcev1 "github.com/fluxcd/source-controller/api/v1"
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
"github.com/fluxcd/flux2/v2/internal/flags" "github.com/fluxcd/flux2/v2/internal/flags"
"github.com/fluxcd/flux2/v2/internal/utils" "github.com/fluxcd/flux2/v2/internal/utils"
@ -142,7 +141,7 @@ var helmReleaseArgs helmReleaseFlags
var supportedHelmReleaseValuesFromKinds = []string{"Secret", "ConfigMap"} var supportedHelmReleaseValuesFromKinds = []string{"Secret", "ConfigMap"}
var supportedHelmReleaseReferenceKinds = []string{sourcev1b2.OCIRepositoryKind, sourcev1.HelmChartKind} var supportedHelmReleaseReferenceKinds = []string{sourcev1.OCIRepositoryKind, sourcev1.HelmChartKind}
func init() { func init() {
createHelmReleaseCmd.Flags().StringVar(&helmReleaseArgs.name, "release-name", "", "name used for the Helm release, defaults to a composition of '[<target-namespace>-]<HelmRelease-name>'") createHelmReleaseCmd.Flags().StringVar(&helmReleaseArgs.name, "release-name", "", "name used for the Helm release, defaults to a composition of '[<target-namespace>-]<HelmRelease-name>'")
@ -222,7 +221,7 @@ func createHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
} }
case helmReleaseArgs.chartRef != "": case helmReleaseArgs.chartRef != "":
kind, name, ns := utils.ParseObjectKindNameNamespace(helmReleaseArgs.chartRef) kind, name, ns := utils.ParseObjectKindNameNamespace(helmReleaseArgs.chartRef)
if kind != sourcev1.HelmChartKind && kind != sourcev1b2.OCIRepositoryKind { if kind != sourcev1.HelmChartKind && kind != sourcev1.OCIRepositoryKind {
return fmt.Errorf("chart reference kind '%s' is not supported, must be one of: %s", return fmt.Errorf("chart reference kind '%s' is not supported, must be one of: %s",
kind, strings.Join(supportedHelmReleaseReferenceKinds, ", ")) kind, strings.Join(supportedHelmReleaseReferenceKinds, ", "))
} }
@ -235,7 +234,7 @@ func createHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
if helmReleaseArgs.kubeConfigSecretRef != "" { if helmReleaseArgs.kubeConfigSecretRef != "" {
helmRelease.Spec.KubeConfig = &meta.KubeConfigReference{ helmRelease.Spec.KubeConfig = &meta.KubeConfigReference{
SecretRef: meta.SecretKeyReference{ SecretRef: &meta.SecretKeyReference{
Name: helmReleaseArgs.kubeConfigSecretRef, Name: helmReleaseArgs.kubeConfigSecretRef,
}, },
} }

@ -20,6 +20,7 @@ import (
"fmt" "fmt"
"regexp/syntax" "regexp/syntax"
"strings" "strings"
"time"
"unicode" "unicode"
"unicode/utf8" "unicode/utf8"
@ -34,12 +35,12 @@ import (
var createImagePolicyCmd = &cobra.Command{ var createImagePolicyCmd = &cobra.Command{
Use: "policy [name]", Use: "policy [name]",
Short: "Create or update an ImagePolicy object", Short: "Create or update an ImagePolicy object",
Long: withPreviewNote(`The create image policy command generates an ImagePolicy resource. Long: `The create image policy command generates an ImagePolicy resource.
An ImagePolicy object calculates a "latest image" given an image An ImagePolicy object calculates a "latest image" given an image
repository and a policy, e.g., semver. repository and a policy, e.g., semver.
The image that sorts highest according to the policy is recorded in The image that sorts highest according to the policy is recorded in
the status of the object.`), the status of the object.`,
Example: ` # Create an ImagePolicy to select the latest stable release Example: ` # Create an ImagePolicy to select the latest stable release
flux create image policy podinfo \ flux create image policy podinfo \
--image-ref=podinfo \ --image-ref=podinfo \
@ -60,6 +61,8 @@ type imagePolicyFlags struct {
numeric string numeric string
filterRegex string filterRegex string
filterExtract string filterExtract string
reflectDigest string
interval time.Duration
} }
var imagePolicyArgs = imagePolicyFlags{} var imagePolicyArgs = imagePolicyFlags{}
@ -72,6 +75,8 @@ func init() {
flags.StringVar(&imagePolicyArgs.numeric, "select-numeric", "", "use numeric sorting to select image; either \"asc\" meaning select the last, or \"desc\" meaning select the first") flags.StringVar(&imagePolicyArgs.numeric, "select-numeric", "", "use numeric sorting to select image; either \"asc\" meaning select the last, or \"desc\" meaning select the first")
flags.StringVar(&imagePolicyArgs.filterRegex, "filter-regex", "", "regular expression pattern used to filter the image tags") flags.StringVar(&imagePolicyArgs.filterRegex, "filter-regex", "", "regular expression pattern used to filter the image tags")
flags.StringVar(&imagePolicyArgs.filterExtract, "filter-extract", "", "replacement pattern (using capture groups from --filter-regex) to use for sorting") flags.StringVar(&imagePolicyArgs.filterExtract, "filter-extract", "", "replacement pattern (using capture groups from --filter-regex) to use for sorting")
flags.StringVar(&imagePolicyArgs.reflectDigest, "reflect-digest", "", "the digest reflection policy to use when observing latest image tags (one of 'Never', 'IfNotPresent', 'Never')")
flags.DurationVar(&imagePolicyArgs.interval, "interval", 0, "the interval at which to check for new image digests when the policy is set to 'Always'")
createImageCmd.AddCommand(createImagePolicyCmd) createImageCmd.AddCommand(createImagePolicyCmd)
} }
@ -153,6 +158,20 @@ func createImagePolicyRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("cannot specify --filter-extract without specifying --filter-regex") return fmt.Errorf("cannot specify --filter-extract without specifying --filter-regex")
} }
if p := imagev1.ReflectionPolicy(imagePolicyArgs.reflectDigest); p != "" {
if p != imagev1.ReflectNever && p != imagev1.ReflectIfNotPresent && p != imagev1.ReflectAlways {
return fmt.Errorf("invalid value for --reflect-digest, must be one of 'Never', 'IfNotPresent', 'Always'")
}
policy.Spec.DigestReflectionPolicy = p
}
if imagePolicyArgs.interval != 0 {
if imagePolicyArgs.reflectDigest != string(imagev1.ReflectAlways) {
return fmt.Errorf("the --interval flag can only be used with the 'Always' digest reflection policy, use --reflect-digest=Always")
}
policy.Spec.Interval = &metav1.Duration{Duration: imagePolicyArgs.interval}
}
if createArgs.export { if createArgs.export {
return printExport(exportImagePolicy(&policy)) return printExport(exportImagePolicy(&policy))
} }

@ -32,8 +32,8 @@ import (
var createImageRepositoryCmd = &cobra.Command{ var createImageRepositoryCmd = &cobra.Command{
Use: "repository [name]", Use: "repository [name]",
Short: "Create or update an ImageRepository object", Short: "Create or update an ImageRepository object",
Long: withPreviewNote(`The create image repository command generates an ImageRepository resource. Long: `The create image repository command generates an ImageRepository resource.
An ImageRepository object specifies an image repository to scan.`), An ImageRepository object specifies an image repository to scan.`,
Example: ` # Create an ImageRepository object to scan the alpine image repository: Example: ` # Create an ImageRepository object to scan the alpine image repository:
flux create image repository alpine-repo --image alpine --interval 20m flux create image repository alpine-repo --image alpine --interval 20m

@ -29,9 +29,9 @@ import (
var createImageUpdateCmd = &cobra.Command{ var createImageUpdateCmd = &cobra.Command{
Use: "update [name]", Use: "update [name]",
Short: "Create or update an ImageUpdateAutomation object", Short: "Create or update an ImageUpdateAutomation object",
Long: withPreviewNote(`The create image update command generates an ImageUpdateAutomation resource. Long: `The create image update command generates an ImageUpdateAutomation resource.
An ImageUpdateAutomation object specifies an automated update to images An ImageUpdateAutomation object specifies an automated update to images
mentioned in YAMLs in a git repository.`), mentioned in YAMLs in a git repository.`,
Example: ` # Configure image updates for the main repository created by flux bootstrap Example: ` # Configure image updates for the main repository created by flux bootstrap
flux create image update flux-system \ flux create image update flux-system \
--git-repo-ref=flux-system \ --git-repo-ref=flux-system \

@ -171,7 +171,7 @@ func createKsCmdRun(cmd *cobra.Command, args []string) error {
if kustomizationArgs.kubeConfigSecretRef != "" { if kustomizationArgs.kubeConfigSecretRef != "" {
kustomization.Spec.KubeConfig = &meta.KubeConfigReference{ kustomization.Spec.KubeConfig = &meta.KubeConfigReference{
SecretRef: meta.SecretKeyReference{ SecretRef: &meta.SecretKeyReference{
Name: kustomizationArgs.kubeConfigSecretRef, Name: kustomizationArgs.kubeConfigSecretRef,
}, },
} }

@ -172,7 +172,7 @@ func createSecretGitCmdRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("git URL scheme '%s' not supported, can be: ssh, http and https", u.Scheme) return fmt.Errorf("git URL scheme '%s' not supported, can be: ssh, http and https", u.Scheme)
} }
secret, err := sourcesecret.Generate(opts) secret, err := sourcesecret.GenerateGit(opts)
if err != nil { if err != nil {
return err return err
} }

@ -99,7 +99,7 @@ func createSecretGitHubAppCmdRun(cmd *cobra.Command, args []string) error {
opts.GitHubAppBaseURL = secretGitHubAppArgs.baseURL opts.GitHubAppBaseURL = secretGitHubAppArgs.baseURL
} }
secret, err := sourcesecret.Generate(opts) secret, err := sourcesecret.GenerateGitHubApp(opts)
if err != nil { if err != nil {
return err return err
} }

@ -83,10 +83,12 @@ func createSecretHelmCmdRun(cmd *cobra.Command, args []string) error {
} }
var certFile, keyFile []byte var certFile, keyFile []byte
if secretHelmArgs.tlsCrtFile != "" && secretHelmArgs.tlsKeyFile != "" { if secretHelmArgs.tlsCrtFile != "" {
if certFile, err = os.ReadFile(secretHelmArgs.tlsCrtFile); err != nil { if certFile, err = os.ReadFile(secretHelmArgs.tlsCrtFile); err != nil {
return fmt.Errorf("failed to read cert file: %w", err) return fmt.Errorf("failed to read cert file: %w", err)
} }
}
if secretHelmArgs.tlsKeyFile != "" {
if keyFile, err = os.ReadFile(secretHelmArgs.tlsKeyFile); err != nil { if keyFile, err = os.ReadFile(secretHelmArgs.tlsKeyFile); err != nil {
return fmt.Errorf("failed to read key file: %w", err) return fmt.Errorf("failed to read key file: %w", err)
} }
@ -102,7 +104,7 @@ func createSecretHelmCmdRun(cmd *cobra.Command, args []string) error {
TLSCrt: certFile, TLSCrt: certFile,
TLSKey: keyFile, TLSKey: keyFile,
} }
secret, err := sourcesecret.Generate(opts) secret, err := sourcesecret.GenerateHelm(opts)
if err != nil { if err != nil {
return err return err
} }

@ -132,7 +132,7 @@ func createSecretNotationCmdRun(cmd *cobra.Command, args []string) error {
VerificationCrts: caCerts, VerificationCrts: caCerts,
TrustPolicy: policy, TrustPolicy: policy,
} }
secret, err := sourcesecret.Generate(opts) secret, err := sourcesecret.GenerateNotation(opts)
if err != nil { if err != nil {
return err return err
} }

@ -92,7 +92,7 @@ func createSecretOCICmdRun(cmd *cobra.Command, args []string) error {
Username: secretOCIArgs.username, Username: secretOCIArgs.username,
} }
secret, err := sourcesecret.Generate(opts) secret, err := sourcesecret.GenerateOCI(opts)
if err != nil { if err != nil {
return err return err
} }

@ -83,7 +83,7 @@ func createSecretProxyCmdRun(cmd *cobra.Command, args []string) error {
Username: secretProxyArgs.username, Username: secretProxyArgs.username,
Password: secretProxyArgs.password, Password: secretProxyArgs.password,
} }
secret, err := sourcesecret.Generate(opts) secret, err := sourcesecret.GenerateProxy(opts)
if err != nil { if err != nil {
return err return err
} }

@ -84,16 +84,18 @@ func createSecretTLSCmdRun(cmd *cobra.Command, args []string) error {
} }
} }
if secretTLSArgs.tlsCrtFile != "" && secretTLSArgs.tlsKeyFile != "" { if secretTLSArgs.tlsCrtFile != "" {
if opts.TLSCrt, err = os.ReadFile(secretTLSArgs.tlsCrtFile); err != nil { if opts.TLSCrt, err = os.ReadFile(secretTLSArgs.tlsCrtFile); err != nil {
return fmt.Errorf("failed to read cert file: %w", err) return fmt.Errorf("failed to read cert file: %w", err)
} }
}
if secretTLSArgs.tlsKeyFile != "" {
if opts.TLSKey, err = os.ReadFile(secretTLSArgs.tlsKeyFile); err != nil { if opts.TLSKey, err = os.ReadFile(secretTLSArgs.tlsKeyFile); err != nil {
return fmt.Errorf("failed to read key file: %w", err) return fmt.Errorf("failed to read key file: %w", err)
} }
} }
secret, err := sourcesecret.Generate(opts) secret, err := sourcesecret.GenerateTLS(opts)
if err != nil { if err != nil {
return err return err
} }

@ -63,6 +63,7 @@ type sourceGitFlags struct {
recurseSubmodules bool recurseSubmodules bool
silent bool silent bool
ignorePaths []string ignorePaths []string
sparseCheckoutPaths []string
} }
var createSourceGitCmd = &cobra.Command{ var createSourceGitCmd = &cobra.Command{
@ -138,7 +139,7 @@ func init() {
createSourceGitCmd.Flags().StringVar(&sourceGitArgs.branch, "branch", "", "git branch") createSourceGitCmd.Flags().StringVar(&sourceGitArgs.branch, "branch", "", "git branch")
createSourceGitCmd.Flags().StringVar(&sourceGitArgs.tag, "tag", "", "git tag") createSourceGitCmd.Flags().StringVar(&sourceGitArgs.tag, "tag", "", "git tag")
createSourceGitCmd.Flags().StringVar(&sourceGitArgs.semver, "tag-semver", "", "git tag semver range") createSourceGitCmd.Flags().StringVar(&sourceGitArgs.semver, "tag-semver", "", "git tag semver range")
createSourceGitCmd.Flags().StringVar(&sourceGitArgs.refName, "ref-name", "", " git reference name") createSourceGitCmd.Flags().StringVar(&sourceGitArgs.refName, "ref-name", "", "git reference name")
createSourceGitCmd.Flags().StringVar(&sourceGitArgs.commit, "commit", "", "git commit") createSourceGitCmd.Flags().StringVar(&sourceGitArgs.commit, "commit", "", "git commit")
createSourceGitCmd.Flags().StringVarP(&sourceGitArgs.username, "username", "u", "", "basic authentication username") createSourceGitCmd.Flags().StringVarP(&sourceGitArgs.username, "username", "u", "", "basic authentication username")
createSourceGitCmd.Flags().StringVarP(&sourceGitArgs.password, "password", "p", "", "basic authentication password") createSourceGitCmd.Flags().StringVarP(&sourceGitArgs.password, "password", "p", "", "basic authentication password")
@ -154,6 +155,7 @@ func init() {
"when enabled, configures the GitRepository source to initialize and include Git submodules in the artifact it produces") "when enabled, configures the GitRepository source to initialize and include Git submodules in the artifact it produces")
createSourceGitCmd.Flags().BoolVarP(&sourceGitArgs.silent, "silent", "s", false, "assumes the deploy key is already setup, skips confirmation") createSourceGitCmd.Flags().BoolVarP(&sourceGitArgs.silent, "silent", "s", false, "assumes the deploy key is already setup, skips confirmation")
createSourceGitCmd.Flags().StringSliceVar(&sourceGitArgs.ignorePaths, "ignore-paths", nil, "set paths to ignore in git resource (can specify multiple paths with commas: path1,path2)") createSourceGitCmd.Flags().StringSliceVar(&sourceGitArgs.ignorePaths, "ignore-paths", nil, "set paths to ignore in git resource (can specify multiple paths with commas: path1,path2)")
createSourceGitCmd.Flags().StringSliceVar(&sourceGitArgs.sparseCheckoutPaths, "sparse-checkout-paths", nil, "set paths to sparse checkout in git resource (can specify multiple paths with commas: path1,path2)")
createSourceCmd.AddCommand(createSourceGitCmd) createSourceCmd.AddCommand(createSourceGitCmd)
} }
@ -220,6 +222,7 @@ func createSourceGitCmdRun(cmd *cobra.Command, args []string) error {
RecurseSubmodules: sourceGitArgs.recurseSubmodules, RecurseSubmodules: sourceGitArgs.recurseSubmodules,
Reference: &sourcev1.GitRepositoryRef{}, Reference: &sourcev1.GitRepositoryRef{},
Ignore: ignorePaths, Ignore: ignorePaths,
SparseCheckout: sourceGitArgs.sparseCheckoutPaths,
}, },
} }
@ -302,7 +305,7 @@ func createSourceGitCmdRun(cmd *cobra.Command, args []string) error {
secretOpts.Username = sourceGitArgs.username secretOpts.Username = sourceGitArgs.username
secretOpts.Password = sourceGitArgs.password secretOpts.Password = sourceGitArgs.password
} }
secret, err := sourcesecret.Generate(secretOpts) secret, err := sourcesecret.GenerateGit(secretOpts)
if err != nil { if err != nil {
return err return err
} }

@ -87,7 +87,7 @@ func (r *reconciler) conditionFunc() (bool, error) {
} }
func TestCreateSourceGitExport(t *testing.T) { func TestCreateSourceGitExport(t *testing.T) {
var command = "create source git podinfo --url=https://github.com/stefanprodan/podinfo --branch=master --ignore-paths .cosign,non-existent-dir/ -n default --interval 1m --export --timeout=" + testTimeout.String() var command = "create source git podinfo --url=https://github.com/stefanprodan/podinfo --branch=master --sparse-checkout-paths .cosign,non-existent-dir/ --ignore-paths .cosign,non-existent-dir/ -n default --interval 1m --export --timeout=" + testTimeout.String()
cases := []struct { cases := []struct {
name string name string
@ -101,7 +101,7 @@ func TestCreateSourceGitExport(t *testing.T) {
}, },
{ {
name: "no args", name: "no args",
args: "create secret git", args: "create source git --url=https://github.com/stefanprodan/podinfo",
assert: assertError("name is required"), assert: assertError("name is required"),
}, },
{ {

@ -202,7 +202,7 @@ func createSourceHelmCmdRun(cmd *cobra.Command, args []string) error {
TLSKey: keyFile, TLSKey: keyFile,
ManifestFile: sourcesecret.MakeDefaultOptions().ManifestFile, ManifestFile: sourcesecret.MakeDefaultOptions().ManifestFile,
} }
secret, err := sourcesecret.Generate(secretOpts) secret, err := sourcesecret.GenerateHelm(secretOpts)
if err != nil { if err != nil {
return err return err
} }

@ -29,9 +29,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client"
"github.com/fluxcd/pkg/apis/meta" "github.com/fluxcd/pkg/apis/meta"
sourcev1 "github.com/fluxcd/source-controller/api/v1" sourcev1 "github.com/fluxcd/source-controller/api/v1"
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
"github.com/fluxcd/flux2/v2/internal/flags" "github.com/fluxcd/flux2/v2/internal/flags"
"github.com/fluxcd/flux2/v2/internal/utils" "github.com/fluxcd/flux2/v2/internal/utils"
@ -81,7 +79,7 @@ var sourceOCIRepositoryArgs = newSourceOCIFlags()
func newSourceOCIFlags() sourceOCIRepositoryFlags { func newSourceOCIFlags() sourceOCIRepositoryFlags {
return sourceOCIRepositoryFlags{ return sourceOCIRepositoryFlags{
provider: flags.SourceOCIProvider(sourcev1b2.GenericOCIProvider), provider: flags.SourceOCIProvider(sourcev1.GenericOCIProvider),
} }
} }
@ -127,20 +125,20 @@ func createSourceOCIRepositoryCmdRun(cmd *cobra.Command, args []string) error {
ignorePaths = &ignorePathsStr ignorePaths = &ignorePathsStr
} }
repository := &sourcev1b2.OCIRepository{ repository := &sourcev1.OCIRepository{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: name, Name: name,
Namespace: *kubeconfigArgs.Namespace, Namespace: *kubeconfigArgs.Namespace,
Labels: sourceLabels, Labels: sourceLabels,
}, },
Spec: sourcev1b2.OCIRepositorySpec{ Spec: sourcev1.OCIRepositorySpec{
Provider: sourceOCIRepositoryArgs.provider.String(), Provider: sourceOCIRepositoryArgs.provider.String(),
URL: sourceOCIRepositoryArgs.url, URL: sourceOCIRepositoryArgs.url,
Insecure: sourceOCIRepositoryArgs.insecure, Insecure: sourceOCIRepositoryArgs.insecure,
Interval: metav1.Duration{ Interval: metav1.Duration{
Duration: createArgs.interval, Duration: createArgs.interval,
}, },
Reference: &sourcev1b2.OCIRepositoryRef{}, Reference: &sourcev1.OCIRepositoryRef{},
Ignore: ignorePaths, Ignore: ignorePaths,
}, },
} }
@ -237,13 +235,13 @@ func createSourceOCIRepositoryCmdRun(cmd *cobra.Command, args []string) error {
} }
func upsertOCIRepository(ctx context.Context, kubeClient client.Client, func upsertOCIRepository(ctx context.Context, kubeClient client.Client,
ociRepository *sourcev1b2.OCIRepository) (types.NamespacedName, error) { ociRepository *sourcev1.OCIRepository) (types.NamespacedName, error) {
namespacedName := types.NamespacedName{ namespacedName := types.NamespacedName{
Namespace: ociRepository.GetNamespace(), Namespace: ociRepository.GetNamespace(),
Name: ociRepository.GetName(), Name: ociRepository.GetName(),
} }
var existing sourcev1b2.OCIRepository var existing sourcev1.OCIRepository
err := kubeClient.Get(ctx, namespacedName, &existing) err := kubeClient.Get(ctx, namespacedName, &existing)
if err != nil { if err != nil {
if errors.IsNotFound(err) { if errors.IsNotFound(err) {

@ -59,6 +59,7 @@ const (
type tenantFlags struct { type tenantFlags struct {
namespaces []string namespaces []string
clusterRole string clusterRole string
account string
} }
var tenantArgs tenantFlags var tenantArgs tenantFlags
@ -66,6 +67,7 @@ var tenantArgs tenantFlags
func init() { func init() {
createTenantCmd.Flags().StringSliceVar(&tenantArgs.namespaces, "with-namespace", nil, "namespace belonging to this tenant") createTenantCmd.Flags().StringSliceVar(&tenantArgs.namespaces, "with-namespace", nil, "namespace belonging to this tenant")
createTenantCmd.Flags().StringVar(&tenantArgs.clusterRole, "cluster-role", "cluster-admin", "cluster role of the tenant role binding") createTenantCmd.Flags().StringVar(&tenantArgs.clusterRole, "cluster-role", "cluster-admin", "cluster role of the tenant role binding")
createTenantCmd.Flags().StringVar(&tenantArgs.account, "with-service-account", "", "service account belonging to this tenant")
createCmd.AddCommand(createTenantCmd) createCmd.AddCommand(createTenantCmd)
} }
@ -107,9 +109,17 @@ func createTenantCmdRun(cmd *cobra.Command, args []string) error {
} }
namespaces = append(namespaces, namespace) namespaces = append(namespaces, namespace)
accountName := tenant
if tenantArgs.account != "" {
accountName = tenantArgs.account
}
if err := validation.IsQualifiedName(accountName); len(err) > 0 {
return fmt.Errorf("invalid service-account name '%s': %v", accountName, err)
}
account := corev1.ServiceAccount{ account := corev1.ServiceAccount{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: tenant, Name: accountName,
Namespace: ns, Namespace: ns,
Labels: objLabels, Labels: objLabels,
}, },
@ -131,7 +141,7 @@ func createTenantCmdRun(cmd *cobra.Command, args []string) error {
}, },
{ {
Kind: "ServiceAccount", Kind: "ServiceAccount",
Name: tenant, Name: accountName,
Namespace: ns, Namespace: ns,
}, },
}, },
@ -283,9 +293,9 @@ func exportTenant(namespace corev1.Namespace, account corev1.ServiceAccount, rol
return err return err
} }
fmt.Println("---") rootCmd.Println("---")
data = bytes.Replace(data, []byte("spec: {}\n"), []byte(""), 1) data = bytes.Replace(data, []byte("spec: {}\n"), []byte(""), 1)
fmt.Println(resourceToString(data)) rootCmd.Println(resourceToString(data))
account.TypeMeta = metav1.TypeMeta{ account.TypeMeta = metav1.TypeMeta{
APIVersion: "v1", APIVersion: "v1",
@ -296,9 +306,9 @@ func exportTenant(namespace corev1.Namespace, account corev1.ServiceAccount, rol
return err return err
} }
fmt.Println("---") rootCmd.Println("---")
data = bytes.Replace(data, []byte("spec: {}\n"), []byte(""), 1) data = bytes.Replace(data, []byte("spec: {}\n"), []byte(""), 1)
fmt.Println(resourceToString(data)) rootCmd.Println(resourceToString(data))
roleBinding.TypeMeta = metav1.TypeMeta{ roleBinding.TypeMeta = metav1.TypeMeta{
APIVersion: "rbac.authorization.k8s.io/v1", APIVersion: "rbac.authorization.k8s.io/v1",
@ -309,8 +319,8 @@ func exportTenant(namespace corev1.Namespace, account corev1.ServiceAccount, rol
return err return err
} }
fmt.Println("---") rootCmd.Println("---")
fmt.Println(resourceToString(data)) rootCmd.Println(resourceToString(data))
return nil return nil
} }

@ -0,0 +1,68 @@
//go:build e2e
// +build e2e
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"testing"
)
func TestCreateTenant(t *testing.T) {
tests := []struct {
name string
args string
assert assertFunc
}{
{
name: "no args",
args: "create tenant",
assert: assertError("name is required"),
},
{
name: "no namespace",
args: "create tenant dev-team --cluster-role=cluster-admin",
assert: assertError("with-namespace is required"),
},
{
name: "basic tenant",
args: "create tenant dev-team --with-namespace=apps --cluster-role=cluster-admin --export",
assert: assertGoldenFile("./testdata/create_tenant/tenant-basic.yaml"),
},
{
name: "tenant with custom serviceaccount",
args: "create tenant dev-team --with-namespace=apps --cluster-role=cluster-admin --with-service-account=flux-tenant --export",
assert: assertGoldenFile("./testdata/create_tenant/tenant-with-service-account.yaml"),
},
{
name: "tenant with custom cluster role",
args: "create tenant dev-team --with-namespace=apps --cluster-role=custom-role --export",
assert: assertGoldenFile("./testdata/create_tenant/tenant-with-cluster-role.yaml"),
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
cmd := cmdTestCase{
args: tt.args,
assert: tt.assert,
}
cmd.runTestCmd(t)
})
}
}

@ -21,7 +21,6 @@ import (
"fmt" "fmt"
helmv2 "github.com/fluxcd/helm-controller/api/v2" helmv2 "github.com/fluxcd/helm-controller/api/v2"
"github.com/fluxcd/pkg/apis/meta"
"github.com/fluxcd/pkg/chartutil" "github.com/fluxcd/pkg/chartutil"
"github.com/go-logr/logr" "github.com/go-logr/logr"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -41,7 +40,10 @@ WARNING: This command will print sensitive information if Kubernetes Secrets are
flux debug hr podinfo --show-status flux debug hr podinfo --show-status
# Export the final values of a Helm release composed from referred ConfigMaps and Secrets # Export the final values of a Helm release composed from referred ConfigMaps and Secrets
flux debug hr podinfo --show-values > values.yaml`, flux debug hr podinfo --show-values > values.yaml
# Print the reconciliation history of a Helm release
flux debug hr podinfo --show-history`,
RunE: debugHelmReleaseCmdRun, RunE: debugHelmReleaseCmdRun,
Args: cobra.ExactArgs(1), Args: cobra.ExactArgs(1),
ValidArgsFunction: resourceNamesCompletionFunc(helmv2.GroupVersion.WithKind(helmv2.HelmReleaseKind)), ValidArgsFunction: resourceNamesCompletionFunc(helmv2.GroupVersion.WithKind(helmv2.HelmReleaseKind)),
@ -50,6 +52,7 @@ WARNING: This command will print sensitive information if Kubernetes Secrets are
type debugHelmReleaseFlags struct { type debugHelmReleaseFlags struct {
showStatus bool showStatus bool
showValues bool showValues bool
showHistory bool
} }
var debugHelmReleaseArgs debugHelmReleaseFlags var debugHelmReleaseArgs debugHelmReleaseFlags
@ -57,15 +60,26 @@ var debugHelmReleaseArgs debugHelmReleaseFlags
func init() { func init() {
debugHelmReleaseCmd.Flags().BoolVar(&debugHelmReleaseArgs.showStatus, "show-status", false, "print the status of the Helm release") debugHelmReleaseCmd.Flags().BoolVar(&debugHelmReleaseArgs.showStatus, "show-status", false, "print the status of the Helm release")
debugHelmReleaseCmd.Flags().BoolVar(&debugHelmReleaseArgs.showValues, "show-values", false, "print the final values of the Helm release") debugHelmReleaseCmd.Flags().BoolVar(&debugHelmReleaseArgs.showValues, "show-values", false, "print the final values of the Helm release")
debugHelmReleaseCmd.Flags().BoolVar(&debugHelmReleaseArgs.showHistory, "show-history", false, "print the reconciliation history of the Helm release")
debugCmd.AddCommand(debugHelmReleaseCmd) debugCmd.AddCommand(debugHelmReleaseCmd)
} }
func debugHelmReleaseCmdRun(cmd *cobra.Command, args []string) error { func debugHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
name := args[0] name := args[0]
if (!debugHelmReleaseArgs.showStatus && !debugHelmReleaseArgs.showValues) || flagsSet := 0
(debugHelmReleaseArgs.showStatus && debugHelmReleaseArgs.showValues) { if debugHelmReleaseArgs.showStatus {
return fmt.Errorf("either --show-status or --show-values must be set") flagsSet++
}
if debugHelmReleaseArgs.showValues {
flagsSet++
}
if debugHelmReleaseArgs.showHistory {
flagsSet++
}
if flagsSet != 1 {
return fmt.Errorf("exactly one of --show-status, --show-values, or --show-history must be set")
} }
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout) ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
@ -93,23 +107,12 @@ func debugHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
} }
if debugHelmReleaseArgs.showValues { if debugHelmReleaseArgs.showValues {
// TODO(stefan): remove the mapping when helm-controller/api v1.2.0 has been released
var valuesRefs []meta.ValuesReference
for _, source := range hr.Spec.ValuesFrom {
valuesRefs = append(valuesRefs, meta.ValuesReference{
Kind: source.Kind,
Name: source.Name,
ValuesKey: source.ValuesKey,
Optional: source.Optional,
})
}
finalValues, err := chartutil.ChartValuesFromReferences(ctx, finalValues, err := chartutil.ChartValuesFromReferences(ctx,
logr.Discard(), logr.Discard(),
kubeClient, kubeClient,
hr.GetNamespace(), hr.GetNamespace(),
hr.GetValues(), hr.GetValues(),
valuesRefs...) hr.Spec.ValuesFrom...)
if err != nil { if err != nil {
return err return err
} }
@ -121,5 +124,19 @@ func debugHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
rootCmd.Print(string(values)) rootCmd.Print(string(values))
} }
if debugHelmReleaseArgs.showHistory {
if len(hr.Status.History) == 0 {
hr.Status.History = helmv2.Snapshots{}
}
history, err := yaml.Marshal(hr.Status.History)
if err != nil {
return err
}
rootCmd.Println("# History documentation: https://fluxcd.io/flux/components/helm/helmreleases/#helmrelease-status")
rootCmd.Print(string(history))
return nil
}
return nil return nil
} }

@ -56,6 +56,18 @@ func TestDebugHelmRelease(t *testing.T) {
"testdata/debug_helmrelease/values-from.golden.yaml", "testdata/debug_helmrelease/values-from.golden.yaml",
tmpl, tmpl,
}, },
{
"debug history",
"debug helmrelease test-with-history --show-history --show-status=false",
"testdata/debug_helmrelease/history.golden.yaml",
tmpl,
},
{
"debug history empty",
"debug helmrelease test-values-inline --show-history --show-status=false",
"testdata/debug_helmrelease/history-empty.golden.yaml",
tmpl,
},
} }
for _, tt := range cases { for _, tt := range cases {

@ -25,7 +25,7 @@ import (
var deleteImagePolicyCmd = &cobra.Command{ var deleteImagePolicyCmd = &cobra.Command{
Use: "policy [name]", Use: "policy [name]",
Short: "Delete an ImagePolicy object", Short: "Delete an ImagePolicy object",
Long: withPreviewNote(`The delete image policy command deletes the given ImagePolicy from the cluster.`), Long: `The delete image policy command deletes the given ImagePolicy from the cluster.`,
Example: ` # Delete an image policy Example: ` # Delete an image policy
flux delete image policy alpine3.x`, flux delete image policy alpine3.x`,
ValidArgsFunction: resourceNamesCompletionFunc(imagev1.GroupVersion.WithKind(imagev1.ImagePolicyKind)), ValidArgsFunction: resourceNamesCompletionFunc(imagev1.GroupVersion.WithKind(imagev1.ImagePolicyKind)),

@ -25,7 +25,7 @@ import (
var deleteImageRepositoryCmd = &cobra.Command{ var deleteImageRepositoryCmd = &cobra.Command{
Use: "repository [name]", Use: "repository [name]",
Short: "Delete an ImageRepository object", Short: "Delete an ImageRepository object",
Long: withPreviewNote("The delete image repository command deletes the given ImageRepository from the cluster."), Long: "The delete image repository command deletes the given ImageRepository from the cluster.",
Example: ` # Delete an image repository Example: ` # Delete an image repository
flux delete image repository alpine`, flux delete image repository alpine`,
ValidArgsFunction: resourceNamesCompletionFunc(imagev1.GroupVersion.WithKind(imagev1.ImageRepositoryKind)), ValidArgsFunction: resourceNamesCompletionFunc(imagev1.GroupVersion.WithKind(imagev1.ImageRepositoryKind)),

@ -25,7 +25,7 @@ import (
var deleteImageUpdateCmd = &cobra.Command{ var deleteImageUpdateCmd = &cobra.Command{
Use: "update [name]", Use: "update [name]",
Short: "Delete an ImageUpdateAutomation object", Short: "Delete an ImageUpdateAutomation object",
Long: withPreviewNote(`The delete image update command deletes the given ImageUpdateAutomation from the cluster.`), Long: `The delete image update command deletes the given ImageUpdateAutomation from the cluster.`,
Example: ` # Delete an image update automation Example: ` # Delete an image update automation
flux delete image update latest-images`, flux delete image update latest-images`,
ValidArgsFunction: resourceNamesCompletionFunc(autov1.GroupVersion.WithKind(autov1.ImageUpdateAutomationKind)), ValidArgsFunction: resourceNamesCompletionFunc(autov1.GroupVersion.WithKind(autov1.ImageUpdateAutomationKind)),

@ -19,7 +19,7 @@ package main
import ( import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" sourcev1 "github.com/fluxcd/source-controller/api/v1"
) )
var deleteSourceChartCmd = &cobra.Command{ var deleteSourceChartCmd = &cobra.Command{

@ -19,7 +19,7 @@ package main
import ( import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" sourcev1 "github.com/fluxcd/source-controller/api/v1"
) )
var deleteSourceOCIRepositoryCmd = &cobra.Command{ var deleteSourceOCIRepositoryCmd = &cobra.Command{

@ -21,8 +21,9 @@ import (
"fmt" "fmt"
"os" "os"
oci "github.com/fluxcd/pkg/oci/client" "github.com/fluxcd/pkg/oci"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" sourcev1 "github.com/fluxcd/source-controller/api/v1"
"github.com/google/go-containerregistry/pkg/crane"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/fluxcd/flux2/v2/internal/flags" "github.com/fluxcd/flux2/v2/internal/flags"
@ -31,7 +32,7 @@ import (
var diffArtifactCmd = &cobra.Command{ var diffArtifactCmd = &cobra.Command{
Use: "artifact", Use: "artifact",
Short: "Diff Artifact", Short: "Diff Artifact",
Long: withPreviewNote(`The diff artifact command computes the diff between the remote OCI artifact and a local directory or file`), Long: `The diff artifact command computes the diff between the remote OCI artifact and a local directory or file`,
Example: `# Check if local files differ from remote Example: `# Check if local files differ from remote
flux diff artifact oci://ghcr.io/stefanprodan/manifests:podinfo:6.2.0 --path=./kustomize`, flux diff artifact oci://ghcr.io/stefanprodan/manifests:podinfo:6.2.0 --path=./kustomize`,
RunE: diffArtifactCmdRun, RunE: diffArtifactCmdRun,
@ -42,6 +43,7 @@ type diffArtifactFlags struct {
creds string creds string
provider flags.SourceOCIProvider provider flags.SourceOCIProvider
ignorePaths []string ignorePaths []string
insecure bool
} }
var diffArtifactArgs = newDiffArtifactArgs() var diffArtifactArgs = newDiffArtifactArgs()
@ -57,6 +59,7 @@ func init() {
diffArtifactCmd.Flags().StringVar(&diffArtifactArgs.creds, "creds", "", "credentials for OCI registry in the format <username>[:<password>] if --provider is generic") diffArtifactCmd.Flags().StringVar(&diffArtifactArgs.creds, "creds", "", "credentials for OCI registry in the format <username>[:<password>] if --provider is generic")
diffArtifactCmd.Flags().Var(&diffArtifactArgs.provider, "provider", sourceOCIRepositoryArgs.provider.Description()) diffArtifactCmd.Flags().Var(&diffArtifactArgs.provider, "provider", sourceOCIRepositoryArgs.provider.Description())
diffArtifactCmd.Flags().StringSliceVar(&diffArtifactArgs.ignorePaths, "ignore-paths", excludeOCI, "set paths to ignore in .gitignore format") diffArtifactCmd.Flags().StringSliceVar(&diffArtifactArgs.ignorePaths, "ignore-paths", excludeOCI, "set paths to ignore in .gitignore format")
diffArtifactCmd.Flags().BoolVar(&diffArtifactArgs.insecure, "insecure-registry", false, "allows the remote artifact to be pulled without TLS")
diffCmd.AddCommand(diffArtifactCmd) diffCmd.AddCommand(diffArtifactCmd)
} }
@ -82,24 +85,27 @@ func diffArtifactCmdRun(cmd *cobra.Command, args []string) error {
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout) ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
defer cancel() defer cancel()
ociClient := oci.NewClient(oci.DefaultOptions()) opts := oci.DefaultOptions()
if diffArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && diffArtifactArgs.creds != "" { if diffArtifactArgs.insecure {
logger.Actionf("logging in to registry with credentials") opts = append(opts, crane.Insecure)
if err := ociClient.LoginWithCredentials(diffArtifactArgs.creds); err != nil {
return fmt.Errorf("could not login with credentials: %w", err)
}
} }
if diffArtifactArgs.provider.String() != sourcev1.GenericOCIProvider { if diffArtifactArgs.provider.String() != sourcev1.GenericOCIProvider {
logger.Actionf("logging in to registry with provider credentials") logger.Actionf("logging in to registry with provider credentials")
ociProvider, err := diffArtifactArgs.provider.ToOCIProvider() opt, err := loginWithProvider(ctx, url, diffArtifactArgs.provider.String())
if err != nil { if err != nil {
return fmt.Errorf("provider not supported: %w", err) return fmt.Errorf("error during login with provider: %w", err)
}
opts = append(opts, opt)
} }
if err := ociClient.LoginWithProvider(ctx, url, ociProvider); err != nil { ociClient := oci.NewClient(opts)
return fmt.Errorf("error during login with provider: %w", err)
if diffArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && diffArtifactArgs.creds != "" {
logger.Actionf("logging in to registry with credentials")
if err := ociClient.LoginWithCredentials(diffArtifactArgs.creds); err != nil {
return fmt.Errorf("could not login with credentials: %w", err)
} }
} }

@ -96,7 +96,7 @@ func TestDiffArtifact(t *testing.T) {
tt.url = fmt.Sprintf(tt.url, dockerReg) tt.url = fmt.Sprintf(tt.url, dockerReg)
_, err := executeCommand("push artifact " + tt.url + " --path=" + tt.pushFile + " --source=test --revision=test") _, err := executeCommand("push artifact " + tt.url + " --path=" + tt.pushFile + " --source=test --revision=test")
if err != nil { if err != nil {
t.Fatalf(fmt.Errorf("failed to push image: %w", err).Error()) t.Fatal(fmt.Errorf("failed to push image: %w", err).Error())
} }
cmd := cmdTestCase{ cmd := cmdTestCase{

@ -27,6 +27,7 @@ import (
"github.com/fluxcd/flux2/v2/internal/build" "github.com/fluxcd/flux2/v2/internal/build"
"github.com/fluxcd/pkg/ssa" "github.com/fluxcd/pkg/ssa"
"github.com/fluxcd/pkg/ssa/normalize"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
) )
@ -151,7 +152,7 @@ func createObjectFromFile(objectFile string, templateValues map[string]string, t
t.Fatalf("Error decoding yaml file '%s': %v", objectFile, err) t.Fatalf("Error decoding yaml file '%s': %v", objectFile, err)
} }
if err := ssa.SetNativeKindsDefaults(clientObjects); err != nil { if err := normalize.UnstructuredList(clientObjects); err != nil {
t.Fatalf("Error setting native kinds defaults for '%s': %v", objectFile, err) t.Fatalf("Error setting native kinds defaults for '%s': %v", objectFile, err)
} }

@ -46,7 +46,6 @@ import (
notificationv1 "github.com/fluxcd/notification-controller/api/v1" notificationv1 "github.com/fluxcd/notification-controller/api/v1"
notificationv1b3 "github.com/fluxcd/notification-controller/api/v1beta3" notificationv1b3 "github.com/fluxcd/notification-controller/api/v1beta3"
sourcev1 "github.com/fluxcd/source-controller/api/v1" sourcev1 "github.com/fluxcd/source-controller/api/v1"
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
"github.com/fluxcd/flux2/v2/internal/utils" "github.com/fluxcd/flux2/v2/internal/utils"
"github.com/fluxcd/flux2/v2/pkg/printers" "github.com/fluxcd/flux2/v2/pkg/printers"
@ -113,7 +112,12 @@ func eventsCmdRun(cmd *cobra.Command, args []string) error {
} }
var diffRefNs bool var diffRefNs bool
clientListOpts := []client.ListOption{client.InNamespace(*kubeconfigArgs.Namespace)} // Build the base list options. When --all-namespaces is set we must NOT constrain the
// query to a single namespace, otherwise we silently return a partial result set.
clientListOpts := []client.ListOption{}
if !eventArgs.allNamespaces {
clientListOpts = append(clientListOpts, client.InNamespace(*kubeconfigArgs.Namespace))
}
var refListOpts [][]client.ListOption var refListOpts [][]client.ListOption
if eventArgs.forSelector != "" { if eventArgs.forSelector != "" {
kind, name := getKindNameFromSelector(eventArgs.forSelector) kind, name := getKindNameFromSelector(eventArgs.forSelector)
@ -446,7 +450,7 @@ var fluxKindMap = refMap{
field: []string{"spec", "sourceRef"}, field: []string{"spec", "sourceRef"},
}, },
sourcev1.GitRepositoryKind: {gvk: sourcev1.GroupVersion.WithKind(sourcev1.GitRepositoryKind)}, sourcev1.GitRepositoryKind: {gvk: sourcev1.GroupVersion.WithKind(sourcev1.GitRepositoryKind)},
sourcev1b2.OCIRepositoryKind: {gvk: sourcev1b2.GroupVersion.WithKind(sourcev1b2.OCIRepositoryKind)}, sourcev1.OCIRepositoryKind: {gvk: sourcev1.GroupVersion.WithKind(sourcev1.OCIRepositoryKind)},
sourcev1.BucketKind: {gvk: sourcev1.GroupVersion.WithKind(sourcev1.BucketKind)}, sourcev1.BucketKind: {gvk: sourcev1.GroupVersion.WithKind(sourcev1.BucketKind)},
sourcev1.HelmRepositoryKind: {gvk: sourcev1.GroupVersion.WithKind(sourcev1.HelmRepositoryKind)}, sourcev1.HelmRepositoryKind: {gvk: sourcev1.GroupVersion.WithKind(sourcev1.HelmRepositoryKind)},
autov1.ImageUpdateAutomationKind: {gvk: autov1.GroupVersion.WithKind(autov1.ImageUpdateAutomationKind)}, autov1.ImageUpdateAutomationKind: {gvk: autov1.GroupVersion.WithKind(autov1.ImageUpdateAutomationKind)},

@ -26,7 +26,7 @@ import (
var exportImagePolicyCmd = &cobra.Command{ var exportImagePolicyCmd = &cobra.Command{
Use: "policy [name]", Use: "policy [name]",
Short: "Export ImagePolicy resources in YAML format", Short: "Export ImagePolicy resources in YAML format",
Long: withPreviewNote("The export image policy command exports one or all ImagePolicy resources in YAML format."), Long: "The export image policy command exports one or all ImagePolicy resources in YAML format.",
Example: ` # Export all ImagePolicy resources Example: ` # Export all ImagePolicy resources
flux export image policy --all > image-policies.yaml flux export image policy --all > image-policies.yaml

@ -26,7 +26,7 @@ import (
var exportImageRepositoryCmd = &cobra.Command{ var exportImageRepositoryCmd = &cobra.Command{
Use: "repository [name]", Use: "repository [name]",
Short: "Export ImageRepository resources in YAML format", Short: "Export ImageRepository resources in YAML format",
Long: withPreviewNote("The export image repository command exports one or all ImageRepository resources in YAML format."), Long: "The export image repository command exports one or all ImageRepository resources in YAML format.",
Example: ` # Export all ImageRepository resources Example: ` # Export all ImageRepository resources
flux export image repository --all > image-repositories.yaml flux export image repository --all > image-repositories.yaml

@ -26,7 +26,7 @@ import (
var exportImageUpdateCmd = &cobra.Command{ var exportImageUpdateCmd = &cobra.Command{
Use: "update [name]", Use: "update [name]",
Short: "Export ImageUpdateAutomation resources in YAML format", Short: "Export ImageUpdateAutomation resources in YAML format",
Long: withPreviewNote("The export image update command exports one or all ImageUpdateAutomation resources in YAML format."), Long: "The export image update command exports one or all ImageUpdateAutomation resources in YAML format.",
Example: ` # Export all ImageUpdateAutomation resources Example: ` # Export all ImageUpdateAutomation resources
flux export image update --all > updates.yaml flux export image update --all > updates.yaml

@ -21,7 +21,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" sourcev1 "github.com/fluxcd/source-controller/api/v1"
) )
var exportSourceOCIRepositoryCmd = &cobra.Command{ var exportSourceOCIRepositoryCmd = &cobra.Command{

@ -184,13 +184,13 @@ func (get getCommand) run(cmd *cobra.Command, args []string) error {
if get.list.len() == 0 { if get.list.len() == 0 {
if len(args) > 0 { if len(args) > 0 {
logger.Failuref("%s object '%s' not found in %s namespace", return fmt.Errorf("%s object '%s' not found in %s namespace",
get.kind, get.kind,
args[0], args[0],
namespaceNameOrAny(getArgs.allNamespaces, *kubeconfigArgs.Namespace), namespaceNameOrAny(getArgs.allNamespaces, *kubeconfigArgs.Namespace),
) )
} else if !getAll { } else if !getAll {
logger.Failuref("no %s objects found in %s namespace", return fmt.Errorf("no %s objects found in %s namespace",
get.kind, get.kind,
namespaceNameOrAny(getArgs.allNamespaces, *kubeconfigArgs.Namespace), namespaceNameOrAny(getArgs.allNamespaces, *kubeconfigArgs.Namespace),
) )

@ -87,7 +87,7 @@ var getAllCmd = &cobra.Command{
func logError(err error) { func logError(err error) {
if !apimeta.IsNoMatchError(err) { if !apimeta.IsNoMatchError(err) {
logger.Failuref(err.Error()) logger.Failuref("%s", err.Error())
} }
} }

@ -26,7 +26,7 @@ import (
var getImageAllCmd = &cobra.Command{ var getImageAllCmd = &cobra.Command{
Use: "all", Use: "all",
Short: "Get all image statuses", Short: "Get all image statuses",
Long: withPreviewNote("The get image sub-commands print the statuses of all image objects."), Long: "The get image sub-commands print the statuses of all image objects.",
Example: ` # List all image objects in a namespace Example: ` # List all image objects in a namespace
flux get images all --namespace=flux-system flux get images all --namespace=flux-system
@ -55,7 +55,7 @@ var getImageAllCmd = &cobra.Command{
for _, c := range allImageCmd { for _, c := range allImageCmd {
if err := c.run(cmd, args); err != nil { if err := c.run(cmd, args); err != nil {
logger.Failuref(err.Error()) logger.Failuref("%s", err.Error())
} }
} }

@ -28,7 +28,7 @@ import (
var getImagePolicyCmd = &cobra.Command{ var getImagePolicyCmd = &cobra.Command{
Use: "policy", Use: "policy",
Short: "Get ImagePolicy status", Short: "Get ImagePolicy status",
Long: withPreviewNote("The get image policy command prints the status of ImagePolicy objects."), Long: "The get image policy command prints the status of ImagePolicy objects.",
Example: ` # List all image policies and their status Example: ` # List all image policies and their status
flux get image policy flux get image policy

@ -32,7 +32,7 @@ import (
var getImageRepositoryCmd = &cobra.Command{ var getImageRepositoryCmd = &cobra.Command{
Use: "repository", Use: "repository",
Short: "Get ImageRepository status", Short: "Get ImageRepository status",
Long: withPreviewNote("The get image repository command prints the status of ImageRepository objects."), Long: "The get image repository command prints the status of ImageRepository objects.",
Example: ` # List all image repositories and their status Example: ` # List all image repositories and their status
flux get image repository flux get image repository

@ -32,7 +32,7 @@ import (
var getImageUpdateCmd = &cobra.Command{ var getImageUpdateCmd = &cobra.Command{
Use: "update", Use: "update",
Short: "Get ImageUpdateAutomation status", Short: "Get ImageUpdateAutomation status",
Long: withPreviewNote("The get image update command prints the status of ImageUpdateAutomation objects."), Long: "The get image update command prints the status of ImageUpdateAutomation objects.",
Example: ` # List all image update automation object and their status Example: ` # List all image update automation object and their status
flux get image update flux get image update

@ -21,7 +21,6 @@ import (
apimeta "k8s.io/apimachinery/pkg/api/meta" apimeta "k8s.io/apimachinery/pkg/api/meta"
sourcev1 "github.com/fluxcd/source-controller/api/v1" sourcev1 "github.com/fluxcd/source-controller/api/v1"
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
) )
var getSourceAllCmd = &cobra.Command{ var getSourceAllCmd = &cobra.Command{
@ -42,7 +41,7 @@ var getSourceAllCmd = &cobra.Command{
var allSourceCmd = []getCommand{ var allSourceCmd = []getCommand{
{ {
apiType: ociRepositoryType, apiType: ociRepositoryType,
list: &ociRepositoryListAdapter{&sourcev1b2.OCIRepositoryList{}}, list: &ociRepositoryListAdapter{&sourcev1.OCIRepositoryList{}},
}, },
{ {
apiType: bucketType, apiType: bucketType,
@ -65,7 +64,7 @@ var getSourceAllCmd = &cobra.Command{
for _, c := range allSourceCmd { for _, c := range allSourceCmd {
if err := c.run(cmd, args); err != nil { if err := c.run(cmd, args); err != nil {
if !apimeta.IsNoMatchError(err) { if !apimeta.IsNoMatchError(err) {
logger.Failuref(err.Error()) logger.Failuref("%s", err.Error())
} }
} }
} }

@ -25,7 +25,7 @@ import (
"golang.org/x/text/language" "golang.org/x/text/language"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" sourcev1 "github.com/fluxcd/source-controller/api/v1"
"github.com/fluxcd/flux2/v2/internal/utils" "github.com/fluxcd/flux2/v2/internal/utils"
) )

@ -19,7 +19,10 @@ limitations under the License.
package main package main
import "testing" import (
"fmt"
"testing"
)
func Test_GetCmd(t *testing.T) { func Test_GetCmd(t *testing.T) {
tmpl := map[string]string{ tmpl := map[string]string{
@ -59,3 +62,76 @@ func Test_GetCmd(t *testing.T) {
}) })
} }
} }
func Test_GetCmdErrors(t *testing.T) {
tmpl := map[string]string{
"fluxns": allocateNamespace("flux-system"),
}
testEnv.CreateObjectFile("./testdata/get/objects.yaml", tmpl, t)
tests := []struct {
name string
args string
assert assertFunc
}{
{
name: "specific object not found",
args: "get kustomization non-existent-resource -n " + tmpl["fluxns"],
assert: assertError(fmt.Sprintf("Kustomization object 'non-existent-resource' not found in \"%s\" namespace", tmpl["fluxns"])),
},
{
name: "no objects found in namespace",
args: "get helmrelease -n " + tmpl["fluxns"],
assert: assertError(fmt.Sprintf("no HelmRelease objects found in \"%s\" namespace", tmpl["fluxns"])),
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
cmd := cmdTestCase{
args: tt.args,
assert: tt.assert,
}
cmd.runTestCmd(t)
})
}
}
func Test_GetCmdSuccess(t *testing.T) {
tmpl := map[string]string{
"fluxns": allocateNamespace("flux-system"),
}
testEnv.CreateObjectFile("./testdata/get/objects.yaml", tmpl, t)
tests := []struct {
name string
args string
assert assertFunc
}{
{
name: "list sources git",
args: "get sources git -n " + tmpl["fluxns"],
assert: assertSuccess(),
},
{
name: "get help",
args: "get --help",
assert: assertSuccess(),
},
{
name: "get with all namespaces flag",
args: "get sources git -A",
assert: assertSuccess(),
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
cmd := cmdTestCase{
args: tt.args,
assert: tt.assert,
}
cmd.runTestCmd(t)
})
}
}

@ -38,7 +38,7 @@ func TestImageScanning(t *testing.T) {
"testdata/image/create_image_repository.golden", "testdata/image/create_image_repository.golden",
}, },
{ {
"create image policy podinfo-semver --image-ref=podinfo --interval=10m --select-semver=5.0.x", "create image policy podinfo-semver --image-ref=podinfo --interval=10m --reflect-digest=Always --select-semver=5.0.x",
"testdata/image/create_image_policy.golden", "testdata/image/create_image_policy.golden",
}, },
{ {
@ -46,7 +46,7 @@ func TestImageScanning(t *testing.T) {
"testdata/image/get_image_policy_semver.golden", "testdata/image/get_image_policy_semver.golden",
}, },
{ {
`create image policy podinfo-regex --image-ref=podinfo --interval=10m --select-semver=">4.0.0" --filter-regex="5\.0\.0"`, `create image policy podinfo-regex --image-ref=podinfo --select-semver=">4.0.0" --filter-regex="5\.0\.0"`,
"testdata/image/create_image_policy.golden", "testdata/image/create_image_policy.golden",
}, },
{ {

@ -250,7 +250,7 @@ func installCmdRun(cmd *cobra.Command, args []string) error {
Username: credentials[0], Username: credentials[0],
Password: credentials[1], Password: credentials[1],
} }
imagePullSecret, err := sourcesecret.Generate(secretOpts) imagePullSecret, err := sourcesecret.GenerateOCI(secretOpts)
if err != nil { if err != nil {
return fmt.Errorf("install failed: %w", err) return fmt.Errorf("install failed: %w", err)
} }

@ -20,10 +20,11 @@ import (
"context" "context"
"fmt" "fmt"
"github.com/google/go-containerregistry/pkg/crane"
"github.com/spf13/cobra" "github.com/spf13/cobra"
oci "github.com/fluxcd/pkg/oci/client" "github.com/fluxcd/pkg/oci"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" sourcev1 "github.com/fluxcd/source-controller/api/v1"
"github.com/fluxcd/flux2/v2/internal/flags" "github.com/fluxcd/flux2/v2/internal/flags"
"github.com/fluxcd/flux2/v2/pkg/printers" "github.com/fluxcd/flux2/v2/pkg/printers"
@ -34,6 +35,7 @@ type listArtifactFlags struct {
regexFilter string regexFilter string
creds string creds string
provider flags.SourceOCIProvider provider flags.SourceOCIProvider
insecure bool
} }
var listArtifactArgs = newListArtifactFlags() var listArtifactArgs = newListArtifactFlags()
@ -47,8 +49,8 @@ func newListArtifactFlags() listArtifactFlags {
var listArtifactsCmd = &cobra.Command{ var listArtifactsCmd = &cobra.Command{
Use: "artifacts", Use: "artifacts",
Short: "list artifacts", Short: "list artifacts",
Long: withPreviewNote(`The list command fetches the tags and their metadata from a remote OCI repository. Long: `The list command fetches the tags and their metadata from a remote OCI repository.
The command can read the credentials from '~/.docker/config.json' but they can also be passed with --creds. It can also login to a supported provider with the --provider flag.`), The command can read the credentials from '~/.docker/config.json' but they can also be passed with --creds. It can also login to a supported provider with the --provider flag.`,
Example: ` # List the artifacts stored in an OCI repository Example: ` # List the artifacts stored in an OCI repository
flux list artifact oci://ghcr.io/org/config/app flux list artifact oci://ghcr.io/org/config/app
`, `,
@ -60,6 +62,7 @@ func init() {
listArtifactsCmd.Flags().StringVar(&listArtifactArgs.regexFilter, "filter-regex", "", "filter tags returned from the oci repository using regex") listArtifactsCmd.Flags().StringVar(&listArtifactArgs.regexFilter, "filter-regex", "", "filter tags returned from the oci repository using regex")
listArtifactsCmd.Flags().StringVar(&listArtifactArgs.creds, "creds", "", "credentials for OCI registry in the format <username>[:<password>] if --provider is generic") listArtifactsCmd.Flags().StringVar(&listArtifactArgs.creds, "creds", "", "credentials for OCI registry in the format <username>[:<password>] if --provider is generic")
listArtifactsCmd.Flags().Var(&listArtifactArgs.provider, "provider", listArtifactArgs.provider.Description()) listArtifactsCmd.Flags().Var(&listArtifactArgs.provider, "provider", listArtifactArgs.provider.Description())
listArtifactsCmd.Flags().BoolVar(&listArtifactArgs.insecure, "insecure-registry", false, "allows the remote artifacts list to be fetched without TLS")
listCmd.AddCommand(listArtifactsCmd) listCmd.AddCommand(listArtifactsCmd)
} }
@ -78,24 +81,27 @@ func listArtifactsCmdRun(cmd *cobra.Command, args []string) error {
return err return err
} }
ociClient := oci.NewClient(oci.DefaultOptions()) ociOpts := oci.DefaultOptions()
if listArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && listArtifactArgs.creds != "" {
logger.Actionf("logging in to registry with credentials")
if err := ociClient.LoginWithCredentials(listArtifactArgs.creds); err != nil {
return fmt.Errorf("could not login with credentials: %w", err)
}
}
if listArtifactArgs.provider.String() != sourcev1.GenericOCIProvider { if listArtifactArgs.provider.String() != sourcev1.GenericOCIProvider {
logger.Actionf("logging in to registry with provider credentials") logger.Actionf("logging in to registry with provider credentials")
ociProvider, err := listArtifactArgs.provider.ToOCIProvider() ociOpt, err := loginWithProvider(ctx, url, listArtifactArgs.provider.String())
if err != nil { if err != nil {
return fmt.Errorf("provider not supported: %w", err) return fmt.Errorf("error during login with provider: %w", err)
}
ociOpts = append(ociOpts, ociOpt)
} }
if err := ociClient.LoginWithProvider(ctx, url, ociProvider); err != nil { if listArtifactArgs.insecure {
return fmt.Errorf("error during login with provider: %w", err) ociOpts = append(ociOpts, crane.Insecure)
}
ociClient := oci.NewClient(ociOpts)
if listArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && listArtifactArgs.creds != "" {
logger.Actionf("logging in to registry with credentials")
if err := ociClient.LoginWithCredentials(listArtifactArgs.creds); err != nil {
return fmt.Errorf("could not login with credentials: %w", err)
} }
} }

@ -0,0 +1,184 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"context"
"fmt"
"github.com/spf13/cobra"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/client-go/util/retry"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/fluxcd/flux2/v2/internal/utils"
)
var migrateCmd = &cobra.Command{
Use: "migrate",
Args: cobra.NoArgs,
Short: "Migrate the Flux custom resources to their latest API version",
Long: `The migrate command must be run before a Flux minor version upgrade.
The command migrates the Flux custom resources stored in Kubernetes etcd to their latest API version,
ensuring the Flux components can continue to function correctly after the upgrade.
`,
RunE: runMigrateCmd,
}
func init() {
rootCmd.AddCommand(migrateCmd)
}
func runMigrateCmd(cmd *cobra.Command, args []string) error {
logger.Actionf("starting migration of custom resources")
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
defer cancel()
cfg, err := utils.KubeConfig(kubeconfigArgs, kubeclientOptions)
if err != nil {
return fmt.Errorf("Kubernetes client initialization failed: %s", err.Error())
}
kubeClient, err := client.New(cfg, client.Options{Scheme: utils.NewScheme()})
if err != nil {
return err
}
migrator := NewMigrator(kubeClient, client.MatchingLabels{
"app.kubernetes.io/part-of": "flux",
})
if err := migrator.Run(ctx); err != nil {
return err
}
logger.Successf("custom resources migrated successfully")
return nil
}
type Migrator struct {
labelSelector client.MatchingLabels
kubeClient client.Client
}
// NewMigrator creates a new Migrator instance with the specified label selector.
func NewMigrator(kubeClient client.Client, labelSelector client.MatchingLabels) *Migrator {
return &Migrator{
labelSelector: labelSelector,
kubeClient: kubeClient,
}
}
func (m *Migrator) Run(ctx context.Context) error {
crdList := &apiextensionsv1.CustomResourceDefinitionList{}
if err := m.kubeClient.List(ctx, crdList, m.labelSelector); err != nil {
return fmt.Errorf("failed to list CRDs: %w", err)
}
for _, crd := range crdList.Items {
if err := m.migrateCRD(ctx, crd.Name); err != nil {
return err
}
}
return nil
}
func (m *Migrator) migrateCRD(ctx context.Context, name string) error {
crd := &apiextensionsv1.CustomResourceDefinition{}
if err := m.kubeClient.Get(ctx, client.ObjectKey{Name: name}, crd); err != nil {
return fmt.Errorf("failed to get CRD %s: %w", name, err)
}
// get the latest storage version for the CRD
storageVersion := m.getStorageVersion(crd)
if storageVersion == "" {
return fmt.Errorf("no storage version found for CRD %s", name)
}
// migrate all the resources for the CRD
err := retry.RetryOnConflict(retry.DefaultRetry, func() error {
return m.migrateCR(ctx, crd, storageVersion)
})
if err != nil {
return fmt.Errorf("failed to migrate resources for CRD %s: %w", name, err)
}
// set the CRD status to contain only the latest storage version
if len(crd.Status.StoredVersions) > 1 || crd.Status.StoredVersions[0] != storageVersion {
crd.Status.StoredVersions = []string{storageVersion}
if err := m.kubeClient.Status().Update(ctx, crd); err != nil {
return fmt.Errorf("failed to update CRD %s status: %w", crd.Name, err)
}
logger.Successf("%s migrated to storage version %s", crd.Name, storageVersion)
}
return nil
}
// migrateCR migrates all CRs for the given CRD to the specified version by patching them with an empty patch.
func (m *Migrator) migrateCR(ctx context.Context, crd *apiextensionsv1.CustomResourceDefinition, version string) error {
list := &unstructured.UnstructuredList{}
apiVersion := crd.Spec.Group + "/" + version
listKind := crd.Spec.Names.ListKind
list.SetAPIVersion(apiVersion)
list.SetKind(listKind)
err := m.kubeClient.List(ctx, list, client.InNamespace(""))
if err != nil {
return fmt.Errorf("failed to list resources for CRD %s: %w", crd.Name, err)
}
if len(list.Items) == 0 {
return nil
}
for _, item := range list.Items {
// patch the resource with an empty patch to update the version
if err := m.kubeClient.Patch(
ctx,
&item,
client.RawPatch(client.Merge.Type(), []byte("{}")),
); err != nil && !apierrors.IsNotFound(err) {
return fmt.Errorf(" %s/%s/%s failed to migrate: %w",
item.GetKind(), item.GetNamespace(), item.GetName(), err)
}
logger.Successf("%s/%s/%s migrated to version %s",
item.GetKind(), item.GetNamespace(), item.GetName(), version)
}
return nil
}
// getStorageVersion retrieves the storage version of a CustomResourceDefinition.
func (m *Migrator) getStorageVersion(crd *apiextensionsv1.CustomResourceDefinition) string {
var version string
for _, v := range crd.Spec.Versions {
if v.Storage {
version = v.Name
break
}
}
return version
}

@ -0,0 +1,41 @@
/*
Copyright 2025 The Flux authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"context"
"fmt"
"github.com/google/go-containerregistry/pkg/crane"
"github.com/fluxcd/pkg/auth"
"github.com/fluxcd/pkg/auth/azure"
authutils "github.com/fluxcd/pkg/auth/utils"
)
// loginWithProvider gets a crane authentication option for the given provider and URL.
func loginWithProvider(ctx context.Context, url, provider string) (crane.Option, error) {
var opts []auth.Option
if provider == azure.ProviderName {
opts = append(opts, auth.WithAllowShellOut())
}
authenticator, err := authutils.GetArtifactRegistryCredentials(ctx, provider, url, opts...)
if err != nil {
return nil, fmt.Errorf("could not login to provider %s with url %s: %w", provider, url, err)
}
return crane.WithAuth(authenticator), nil
}

@ -21,19 +21,20 @@ import (
"fmt" "fmt"
"os" "os"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" "github.com/google/go-containerregistry/pkg/crane"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/fluxcd/flux2/v2/internal/flags" "github.com/fluxcd/pkg/oci"
sourcev1 "github.com/fluxcd/source-controller/api/v1"
oci "github.com/fluxcd/pkg/oci/client" "github.com/fluxcd/flux2/v2/internal/flags"
) )
var pullArtifactCmd = &cobra.Command{ var pullArtifactCmd = &cobra.Command{
Use: "artifact", Use: "artifact",
Short: "Pull artifact", Short: "Pull artifact",
Long: withPreviewNote(`The pull artifact command downloads and extracts the OCI artifact content to the given path. Long: `The pull artifact command downloads and extracts the OCI artifact content to the given path.
The command can read the credentials from '~/.docker/config.json' but they can also be passed with --creds. It can also login to a supported provider with the --provider flag.`), The command can read the credentials from '~/.docker/config.json' but they can also be passed with --creds. It can also login to a supported provider with the --provider flag.`,
Example: ` # Pull an OCI artifact created by flux from GHCR Example: ` # Pull an OCI artifact created by flux from GHCR
flux pull artifact oci://ghcr.io/org/manifests/app:v0.0.1 --output ./path/to/local/manifests flux pull artifact oci://ghcr.io/org/manifests/app:v0.0.1 --output ./path/to/local/manifests
`, `,
@ -43,6 +44,7 @@ The command can read the credentials from '~/.docker/config.json' but they can a
type pullArtifactFlags struct { type pullArtifactFlags struct {
output string output string
creds string creds string
insecure bool
provider flags.SourceOCIProvider provider flags.SourceOCIProvider
} }
@ -58,6 +60,7 @@ func init() {
pullArtifactCmd.Flags().StringVarP(&pullArtifactArgs.output, "output", "o", "", "path where the artifact content should be extracted.") pullArtifactCmd.Flags().StringVarP(&pullArtifactArgs.output, "output", "o", "", "path where the artifact content should be extracted.")
pullArtifactCmd.Flags().StringVar(&pullArtifactArgs.creds, "creds", "", "credentials for OCI registry in the format <username>[:<password>] if --provider is generic") pullArtifactCmd.Flags().StringVar(&pullArtifactArgs.creds, "creds", "", "credentials for OCI registry in the format <username>[:<password>] if --provider is generic")
pullArtifactCmd.Flags().Var(&pullArtifactArgs.provider, "provider", sourceOCIRepositoryArgs.provider.Description()) pullArtifactCmd.Flags().Var(&pullArtifactArgs.provider, "provider", sourceOCIRepositoryArgs.provider.Description())
pullArtifactCmd.Flags().BoolVar(&pullArtifactArgs.insecure, "insecure-registry", false, "allows artifacts to be pulled without TLS")
pullCmd.AddCommand(pullArtifactCmd) pullCmd.AddCommand(pullArtifactCmd)
} }
@ -83,24 +86,27 @@ func pullArtifactCmdRun(cmd *cobra.Command, args []string) error {
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout) ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
defer cancel() defer cancel()
ociClient := oci.NewClient(oci.DefaultOptions()) opts := oci.DefaultOptions()
if pullArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && pullArtifactArgs.creds != "" { if pullArtifactArgs.insecure {
logger.Actionf("logging in to registry with credentials") opts = append(opts, crane.Insecure)
if err := ociClient.LoginWithCredentials(pullArtifactArgs.creds); err != nil {
return fmt.Errorf("could not login with credentials: %w", err)
}
} }
if pullArtifactArgs.provider.String() != sourcev1.GenericOCIProvider { if pullArtifactArgs.provider.String() != sourcev1.GenericOCIProvider {
logger.Actionf("logging in to registry with provider credentials") logger.Actionf("logging in to registry with provider credentials")
ociProvider, err := pullArtifactArgs.provider.ToOCIProvider() opt, err := loginWithProvider(ctx, url, pullArtifactArgs.provider.String())
if err != nil { if err != nil {
return fmt.Errorf("provider not supported: %w", err) return fmt.Errorf("error during login with provider: %w", err)
}
opts = append(opts, opt)
} }
if err := ociClient.LoginWithProvider(ctx, url, ociProvider); err != nil { ociClient := oci.NewClient(opts)
return fmt.Errorf("error during login with provider: %w", err)
if pullArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && pullArtifactArgs.creds != "" {
logger.Actionf("logging in to registry with credentials")
if err := ociClient.LoginWithCredentials(pullArtifactArgs.creds); err != nil {
return fmt.Errorf("could not login with credentials: %w", err)
} }
} }

@ -34,9 +34,7 @@ import (
"sigs.k8s.io/yaml" "sigs.k8s.io/yaml"
"github.com/fluxcd/pkg/oci" "github.com/fluxcd/pkg/oci"
"github.com/fluxcd/pkg/oci/auth/login" sourcev1 "github.com/fluxcd/source-controller/api/v1"
"github.com/fluxcd/pkg/oci/client"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
"github.com/fluxcd/flux2/v2/internal/flags" "github.com/fluxcd/flux2/v2/internal/flags"
) )
@ -44,8 +42,8 @@ import (
var pushArtifactCmd = &cobra.Command{ var pushArtifactCmd = &cobra.Command{
Use: "artifact", Use: "artifact",
Short: "Push artifact", Short: "Push artifact",
Long: withPreviewNote(`The push artifact command creates a tarball from the given directory or the single file and uploads the artifact to an OCI repository. Long: `The push artifact command creates a tarball from the given directory or the single file and uploads the artifact to an OCI repository.
The command can read the credentials from '~/.docker/config.json' but they can also be passed with --creds. It can also login to a supported provider with the --provider flag.`), The command can read the credentials from '~/.docker/config.json' but they can also be passed with --creds. It can also login to a supported provider with the --provider flag.`,
Example: ` # Push manifests to GHCR using the short Git SHA as the OCI artifact tag Example: ` # Push manifests to GHCR using the short Git SHA as the OCI artifact tag
echo $GITHUB_PAT | docker login ghcr.io --username flux --password-stdin echo $GITHUB_PAT | docker login ghcr.io --username flux --password-stdin
flux push artifact oci://ghcr.io/org/config/app:$(git rev-parse --short HEAD) \ flux push artifact oci://ghcr.io/org/config/app:$(git rev-parse --short HEAD) \
@ -115,6 +113,7 @@ type pushArtifactFlags struct {
output string output string
debug bool debug bool
reproducible bool reproducible bool
insecure bool
} }
var pushArtifactArgs = newPushArtifactFlags() var pushArtifactArgs = newPushArtifactFlags()
@ -137,6 +136,7 @@ func init() {
"the format in which the artifact digest should be printed, can be 'json' or 'yaml'") "the format in which the artifact digest should be printed, can be 'json' or 'yaml'")
pushArtifactCmd.Flags().BoolVarP(&pushArtifactArgs.debug, "debug", "", false, "display logs from underlying library") pushArtifactCmd.Flags().BoolVarP(&pushArtifactArgs.debug, "debug", "", false, "display logs from underlying library")
pushArtifactCmd.Flags().BoolVar(&pushArtifactArgs.reproducible, "reproducible", false, "ensure reproducible image digests by setting the created timestamp to '1970-01-01T00:00:00Z'") pushArtifactCmd.Flags().BoolVar(&pushArtifactArgs.reproducible, "reproducible", false, "ensure reproducible image digests by setting the created timestamp to '1970-01-01T00:00:00Z'")
pushArtifactCmd.Flags().BoolVar(&pushArtifactArgs.insecure, "insecure-registry", false, "allows artifacts to be pushed without TLS")
pushCmd.AddCommand(pushArtifactCmd) pushCmd.AddCommand(pushArtifactCmd)
} }
@ -159,7 +159,7 @@ func pushArtifactCmdRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("invalid path %q", pushArtifactArgs.path) return fmt.Errorf("invalid path %q", pushArtifactArgs.path)
} }
url, err := client.ParseArtifactURL(ociURL) url, err := oci.ParseArtifactURL(ociURL)
if err != nil { if err != nil {
return err return err
} }
@ -198,7 +198,7 @@ func pushArtifactCmdRun(cmd *cobra.Command, args []string) error {
logs.Warn.SetOutput(os.Stderr) logs.Warn.SetOutput(os.Stderr)
} }
meta := client.Metadata{ meta := oci.Metadata{
Source: pushArtifactArgs.source, Source: pushArtifactArgs.source,
Revision: pushArtifactArgs.revision, Revision: pushArtifactArgs.revision,
Annotations: annotations, Annotations: annotations,
@ -212,29 +212,24 @@ func pushArtifactCmdRun(cmd *cobra.Command, args []string) error {
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout) ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
defer cancel() defer cancel()
var auth authn.Authenticator var authenticator authn.Authenticator
opts := client.DefaultOptions() opts := oci.DefaultOptions()
if pushArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && pushArtifactArgs.creds != "" { if pushArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && pushArtifactArgs.creds != "" {
logger.Actionf("logging in to registry with credentials") logger.Actionf("logging in to registry with credentials")
auth, err = client.GetAuthFromCredentials(pushArtifactArgs.creds) authenticator, err = oci.GetAuthFromCredentials(pushArtifactArgs.creds)
if err != nil { if err != nil {
return fmt.Errorf("could not login with credentials: %w", err) return fmt.Errorf("could not login with credentials: %w", err)
} }
opts = append(opts, crane.WithAuth(auth)) opts = append(opts, crane.WithAuth(authenticator))
} }
if pushArtifactArgs.provider.String() != sourcev1.GenericOCIProvider { if provider := pushArtifactArgs.provider.String(); provider != sourcev1.GenericOCIProvider {
logger.Actionf("logging in to registry with provider credentials") logger.Actionf("logging in to registry with provider credentials")
ociProvider, err := pushArtifactArgs.provider.ToOCIProvider() authOpt, err := loginWithProvider(ctx, url, provider)
if err != nil {
return fmt.Errorf("provider not supported: %w", err)
}
auth, err = login.NewManager().Login(ctx, url, ref, getProviderLoginOption(ociProvider))
if err != nil { if err != nil {
return fmt.Errorf("error during login with provider: %w", err) return fmt.Errorf("error during login with provider: %w", err)
} }
opts = append(opts, crane.WithAuth(auth)) opts = append(opts, authOpt)
} }
if rootArgs.timeout != 0 { if rootArgs.timeout != 0 {
@ -249,27 +244,37 @@ func pushArtifactCmdRun(cmd *cobra.Command, args []string) error {
Cap: rootArgs.timeout, Cap: rootArgs.timeout,
} }
if auth == nil { if authenticator == nil {
auth, err = authn.DefaultKeychain.Resolve(ref.Context()) authenticator, err = authn.DefaultKeychain.Resolve(ref.Context())
if err != nil { if err != nil {
return err return err
} }
} }
transportOpts, err := client.WithRetryTransport(ctx, ref, auth, backoff, []string{ref.Context().Scope(transport.PushScope)}) transportOpts, err := oci.WithRetryTransport(ctx,
ref,
authenticator,
backoff,
[]string{ref.Context().Scope(transport.PushScope)},
pushArtifactArgs.insecure,
)
if err != nil { if err != nil {
return fmt.Errorf("error setting up transport: %w", err) return fmt.Errorf("error setting up transport: %w", err)
} }
opts = append(opts, transportOpts, client.WithRetryBackOff(backoff)) opts = append(opts, transportOpts, oci.WithRetryBackOff(backoff))
} }
if pushArtifactArgs.output == "" { if pushArtifactArgs.output == "" {
logger.Actionf("pushing artifact to %s", url) logger.Actionf("pushing artifact to %s", url)
} }
ociClient := client.NewClient(opts) if pushArtifactArgs.insecure {
opts = append(opts, crane.Insecure)
}
ociClient := oci.NewClient(opts)
digestURL, err := ociClient.Push(ctx, url, path, digestURL, err := ociClient.Push(ctx, url, path,
client.WithPushMetadata(meta), oci.WithPushMetadata(meta),
client.WithPushIgnorePaths(pushArtifactArgs.ignorePaths...), oci.WithPushIgnorePaths(pushArtifactArgs.ignorePaths...),
) )
if err != nil { if err != nil {
return fmt.Errorf("pushing artifact failed: %w", err) return fmt.Errorf("pushing artifact failed: %w", err)
@ -317,16 +322,3 @@ func pushArtifactCmdRun(cmd *cobra.Command, args []string) error {
return nil return nil
} }
func getProviderLoginOption(provider oci.Provider) login.ProviderOptions {
var opts login.ProviderOptions
switch provider {
case oci.ProviderAzure:
opts.AzureAutoLogin = true
case oci.ProviderAWS:
opts.AwsAutoLogin = true
case oci.ProviderGCP:
opts.GcpAutoLogin = true
}
return opts
}

@ -108,7 +108,7 @@ func isObjectReady(obj client.Object, statusType objectStatusType) (bool, error)
case kstatus.InProgressStatus: case kstatus.InProgressStatus:
return false, nil return false, nil
default: default:
return false, fmt.Errorf(result.Message) return false, fmt.Errorf("%s", result.Message)
} }
} }

@ -132,7 +132,7 @@ func (reconcile reconcileCommand) run(cmd *cobra.Command, args []string) error {
if readyCond.Status != metav1.ConditionTrue { if readyCond.Status != metav1.ConditionTrue {
return fmt.Errorf("%s reconciliation failed: '%s'", reconcile.kind, readyCond.Message) return fmt.Errorf("%s reconciliation failed: '%s'", reconcile.kind, readyCond.Message)
} }
logger.Successf(reconcile.object.successMessage()) logger.Successf("%s", reconcile.object.successMessage())
return nil return nil
} }

@ -24,7 +24,6 @@ import (
helmv2 "github.com/fluxcd/helm-controller/api/v2" helmv2 "github.com/fluxcd/helm-controller/api/v2"
sourcev1 "github.com/fluxcd/source-controller/api/v1" sourcev1 "github.com/fluxcd/source-controller/api/v1"
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
) )
var reconcileHrCmd = &cobra.Command{ var reconcileHrCmd = &cobra.Command{
@ -92,7 +91,7 @@ func (obj helmReleaseAdapter) getSource() (reconcileSource, types.NamespacedName
} }
return reconcileCommand{ return reconcileCommand{
apiType: ociRepositoryType, apiType: ociRepositoryType,
object: ociRepositoryAdapter{&sourcev1b2.OCIRepository{}}, object: ociRepositoryAdapter{&sourcev1.OCIRepository{}},
}, namespacedName }, namespacedName
default: default:
// default case assumes the HelmRelease is using a HelmChartTemplate // default case assumes the HelmRelease is using a HelmChartTemplate

@ -22,7 +22,6 @@ import (
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1" kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1"
sourcev1 "github.com/fluxcd/source-controller/api/v1" sourcev1 "github.com/fluxcd/source-controller/api/v1"
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
) )
var reconcileKsCmd = &cobra.Command{ var reconcileKsCmd = &cobra.Command{
@ -66,10 +65,10 @@ func (obj kustomizationAdapter) reconcileSource() bool {
func (obj kustomizationAdapter) getSource() (reconcileSource, types.NamespacedName) { func (obj kustomizationAdapter) getSource() (reconcileSource, types.NamespacedName) {
var cmd reconcileCommand var cmd reconcileCommand
switch obj.Spec.SourceRef.Kind { switch obj.Spec.SourceRef.Kind {
case sourcev1b2.OCIRepositoryKind: case sourcev1.OCIRepositoryKind:
cmd = reconcileCommand{ cmd = reconcileCommand{
apiType: ociRepositoryType, apiType: ociRepositoryType,
object: ociRepositoryAdapter{&sourcev1b2.OCIRepository{}}, object: ociRepositoryAdapter{&sourcev1.OCIRepository{}},
} }
case sourcev1.GitRepositoryKind: case sourcev1.GitRepositoryKind:
cmd = reconcileCommand{ cmd = reconcileCommand{

@ -21,7 +21,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" sourcev1 "github.com/fluxcd/source-controller/api/v1"
) )
var reconcileSourceOCIRepositoryCmd = &cobra.Command{ var reconcileSourceOCIRepositoryCmd = &cobra.Command{

@ -96,6 +96,6 @@ func (reconcile reconcileWithSourceCommand) run(cmd *cobra.Command, args []strin
if readyCond.Status != metav1.ConditionTrue { if readyCond.Status != metav1.ConditionTrue {
return fmt.Errorf("%s reconciliation failed: %s", reconcile.kind, readyCond.Message) return fmt.Errorf("%s reconciliation failed: %s", reconcile.kind, readyCond.Message)
} }
logger.Successf(reconcile.object.successMessage()) logger.Successf("%s", reconcile.object.successMessage())
return nil return nil
} }

@ -251,9 +251,9 @@ func (resume resumeCommand) printMessage(responses []reconcileResponse) {
continue continue
} }
if r.err != nil { if r.err != nil {
logger.Failuref(r.err.Error()) logger.Failuref("%s", r.err.Error())
} }
logger.Successf("%s %s reconciliation completed", resume.kind, r.asClientObject().GetName()) logger.Successf("%s %s reconciliation completed", resume.kind, r.asClientObject().GetName())
logger.Successf(r.successMessage()) logger.Successf("%s", r.successMessage())
} }
} }

@ -19,7 +19,7 @@ package main
import ( import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" sourcev1 "github.com/fluxcd/source-controller/api/v1"
) )
var resumeSourceOCIRepositoryCmd = &cobra.Command{ var resumeSourceOCIRepositoryCmd = &cobra.Command{

@ -20,7 +20,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client"
sourcev1 "github.com/fluxcd/source-controller/api/v1" sourcev1 "github.com/fluxcd/source-controller/api/v1"
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
) )
// These are general-purpose adapters for attaching methods to, for // These are general-purpose adapters for attaching methods to, for
@ -30,13 +29,13 @@ import (
// sourcev1.ociRepository // sourcev1.ociRepository
var ociRepositoryType = apiType{ var ociRepositoryType = apiType{
kind: sourcev1b2.OCIRepositoryKind, kind: sourcev1.OCIRepositoryKind,
humanKind: "source oci", humanKind: "source oci",
groupVersion: sourcev1b2.GroupVersion, groupVersion: sourcev1.GroupVersion,
} }
type ociRepositoryAdapter struct { type ociRepositoryAdapter struct {
*sourcev1b2.OCIRepository *sourcev1.OCIRepository
} }
func (a ociRepositoryAdapter) asClientObject() client.Object { func (a ociRepositoryAdapter) asClientObject() client.Object {
@ -50,7 +49,7 @@ func (a ociRepositoryAdapter) deepCopyClientObject() client.Object {
// sourcev1b2.OCIRepositoryList // sourcev1b2.OCIRepositoryList
type ociRepositoryListAdapter struct { type ociRepositoryListAdapter struct {
*sourcev1b2.OCIRepositoryList *sourcev1.OCIRepositoryList
} }
func (a ociRepositoryListAdapter) asClientList() client.ObjectList { func (a ociRepositoryListAdapter) asClientList() client.ObjectList {

@ -34,7 +34,6 @@ import (
notificationv1 "github.com/fluxcd/notification-controller/api/v1" notificationv1 "github.com/fluxcd/notification-controller/api/v1"
notificationv1b3 "github.com/fluxcd/notification-controller/api/v1beta3" notificationv1b3 "github.com/fluxcd/notification-controller/api/v1beta3"
sourcev1 "github.com/fluxcd/source-controller/api/v1" sourcev1 "github.com/fluxcd/source-controller/api/v1"
sourcev1b2 "github.com/fluxcd/source-controller/api/v1beta2"
"github.com/fluxcd/flux2/v2/internal/utils" "github.com/fluxcd/flux2/v2/internal/utils"
"github.com/fluxcd/flux2/v2/pkg/printers" "github.com/fluxcd/flux2/v2/pkg/printers"
@ -82,9 +81,9 @@ func runStatsCmd(cmd *cobra.Command, args []string) error {
Group: sourcev1.GroupVersion.Group, Group: sourcev1.GroupVersion.Group,
}, },
{ {
Kind: sourcev1b2.OCIRepositoryKind, Kind: sourcev1.OCIRepositoryKind,
Version: sourcev1b2.GroupVersion.Version, Version: sourcev1.GroupVersion.Version,
Group: sourcev1b2.GroupVersion.Group, Group: sourcev1.GroupVersion.Group,
}, },
{ {
Kind: sourcev1.HelmRepositoryKind, Kind: sourcev1.HelmRepositoryKind,

@ -19,7 +19,7 @@ package main
import ( import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" sourcev1 "github.com/fluxcd/source-controller/api/v1"
) )
var suspendSourceOCIRepositoryCmd = &cobra.Command{ var suspendSourceOCIRepositoryCmd = &cobra.Command{

@ -22,8 +22,8 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
oci "github.com/fluxcd/pkg/oci/client" "github.com/fluxcd/pkg/oci"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" sourcev1 "github.com/fluxcd/source-controller/api/v1"
"github.com/fluxcd/flux2/v2/internal/flags" "github.com/fluxcd/flux2/v2/internal/flags"
) )
@ -31,8 +31,8 @@ import (
var tagArtifactCmd = &cobra.Command{ var tagArtifactCmd = &cobra.Command{
Use: "artifact", Use: "artifact",
Short: "Tag artifact", Short: "Tag artifact",
Long: withPreviewNote(`The tag artifact command creates tags for the given OCI artifact. Long: `The tag artifact command creates tags for the given OCI artifact.
The command can read the credentials from '~/.docker/config.json' but they can also be passed with --creds. It can also login to a supported provider with the --provider flag.`), The command can read the credentials from '~/.docker/config.json' but they can also be passed with --creds. It can also login to a supported provider with the --provider flag.`,
Example: ` # Tag an artifact version as latest Example: ` # Tag an artifact version as latest
flux tag artifact oci://ghcr.io/org/manifests/app:v0.0.1 --tag latest flux tag artifact oci://ghcr.io/org/manifests/app:v0.0.1 --tag latest
`, `,
@ -78,24 +78,23 @@ func tagArtifactCmdRun(cmd *cobra.Command, args []string) error {
ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout) ctx, cancel := context.WithTimeout(context.Background(), rootArgs.timeout)
defer cancel() defer cancel()
ociClient := oci.NewClient(oci.DefaultOptions()) opts := oci.DefaultOptions()
if tagArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && tagArtifactArgs.creds != "" {
logger.Actionf("logging in to registry with credentials")
if err := ociClient.LoginWithCredentials(tagArtifactArgs.creds); err != nil {
return fmt.Errorf("could not login with credentials: %w", err)
}
}
if tagArtifactArgs.provider.String() != sourcev1.GenericOCIProvider { if tagArtifactArgs.provider.String() != sourcev1.GenericOCIProvider {
logger.Actionf("logging in to registry with provider credentials") logger.Actionf("logging in to registry with provider credentials")
ociProvider, err := tagArtifactArgs.provider.ToOCIProvider() opt, err := loginWithProvider(ctx, url, tagArtifactArgs.provider.String())
if err != nil { if err != nil {
return fmt.Errorf("provider not supported: %w", err) return fmt.Errorf("error during login with provider: %w", err)
}
opts = append(opts, opt)
} }
if err := ociClient.LoginWithProvider(ctx, url, ociProvider); err != nil { ociClient := oci.NewClient(opts)
return fmt.Errorf("error during login with provider: %w", err)
if tagArtifactArgs.provider.String() == sourcev1.GenericOCIProvider && tagArtifactArgs.creds != "" {
logger.Actionf("logging in to registry with credentials")
if err := ociClient.LoginWithCredentials(tagArtifactArgs.creds); err != nil {
return fmt.Errorf("could not login with credentials: %w", err)
} }
} }

@ -1,3 +1,3 @@
► checking prerequisites ► checking prerequisites
✔ Kubernetes {{ .serverVersion }} >=1.30.0-0 ✔ Kubernetes {{ .serverVersion }} >=1.31.0-0
✔ prerequisites checks passed ✔ prerequisites checks passed

@ -27,7 +27,7 @@ spec:
kind: HelmRepository kind: HelmRepository
name: podinfo name: podinfo
--- ---
apiVersion: source.toolkit.fluxcd.io/v1beta2 apiVersion: source.toolkit.fluxcd.io/v1
kind: OCIRepository kind: OCIRepository
metadata: metadata:
name: podinfo name: podinfo

@ -36,4 +36,5 @@ stringData:
lbD102oXw9lUefVI0McyQIN9J58ewDC79AG7gU/fTSt6F75OeFLOJmoedQo33Y+s lbD102oXw9lUefVI0McyQIN9J58ewDC79AG7gU/fTSt6F75OeFLOJmoedQo33Y+s
bUytJtOhHbLRNxwgalhjBUNWICrDktqJmumNOEOOPBqVz7RGwUg= bUytJtOhHbLRNxwgalhjBUNWICrDktqJmumNOEOOPBqVz7RGwUg=
-----END RSA PRIVATE KEY----- -----END RSA PRIVATE KEY-----
type: Opaque

@ -35,4 +35,5 @@ stringData:
lbD102oXw9lUefVI0McyQIN9J58ewDC79AG7gU/fTSt6F75OeFLOJmoedQo33Y+s lbD102oXw9lUefVI0McyQIN9J58ewDC79AG7gU/fTSt6F75OeFLOJmoedQo33Y+s
bUytJtOhHbLRNxwgalhjBUNWICrDktqJmumNOEOOPBqVz7RGwUg= bUytJtOhHbLRNxwgalhjBUNWICrDktqJmumNOEOOPBqVz7RGwUg=
-----END RSA PRIVATE KEY----- -----END RSA PRIVATE KEY-----
type: Opaque

@ -7,4 +7,5 @@ metadata:
stringData: stringData:
password: my-password password: my-password
username: my-username username: my-username
type: kubernetes.io/basic-auth

@ -5,6 +5,15 @@ metadata:
name: ghcr name: ghcr
namespace: my-namespace namespace: my-namespace
stringData: stringData:
.dockerconfigjson: '{"auths":{"ghcr.io":{"username":"stefanprodan","password":"password","auth":"c3RlZmFucHJvZGFuOnBhc3N3b3Jk"}}}' .dockerconfigjson: |-
{
"auths": {
"ghcr.io": {
"username": "stefanprodan",
"password": "password",
"auth": "c3RlZmFucHJvZGFuOnBhc3N3b3Jk"
}
}
}
type: kubernetes.io/dockerconfigjson type: kubernetes.io/dockerconfigjson

@ -8,4 +8,5 @@ stringData:
address: https://my-proxy.com address: https://my-proxy.com
password: my-password password: my-password
username: my-username username: my-username
type: Opaque

@ -11,4 +11,7 @@ spec:
interval: 1m0s interval: 1m0s
ref: ref:
branch: master branch: master
sparseCheckout:
- .cosign
- non-existent-dir/
url: https://github.com/stefanprodan/podinfo url: https://github.com/stefanprodan/podinfo

@ -0,0 +1,34 @@
---
apiVersion: v1
kind: Namespace
metadata:
labels:
toolkit.fluxcd.io/tenant: dev-team
name: apps
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
toolkit.fluxcd.io/tenant: dev-team
name: dev-team
namespace: apps
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
toolkit.fluxcd.io/tenant: dev-team
name: dev-team-reconciler
namespace: apps
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: User
name: gotk:apps:reconciler
- kind: ServiceAccount
name: dev-team
namespace: apps

@ -0,0 +1,34 @@
---
apiVersion: v1
kind: Namespace
metadata:
labels:
toolkit.fluxcd.io/tenant: dev-team
name: apps
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
toolkit.fluxcd.io/tenant: dev-team
name: dev-team
namespace: apps
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
toolkit.fluxcd.io/tenant: dev-team
name: dev-team-reconciler
namespace: apps
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: custom-role
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: User
name: gotk:apps:reconciler
- kind: ServiceAccount
name: dev-team
namespace: apps

@ -0,0 +1,34 @@
---
apiVersion: v1
kind: Namespace
metadata:
labels:
toolkit.fluxcd.io/tenant: dev-team
name: apps
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
toolkit.fluxcd.io/tenant: dev-team
name: flux-tenant
namespace: apps
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
toolkit.fluxcd.io/tenant: dev-team
name: dev-team-reconciler
namespace: apps
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: User
name: gotk:apps:reconciler
- kind: ServiceAccount
name: flux-tenant
namespace: apps

@ -0,0 +1,2 @@
# History documentation: https://fluxcd.io/flux/components/helm/helmreleases/#helmrelease-status
[]

@ -0,0 +1,25 @@
# History documentation: https://fluxcd.io/flux/components/helm/helmreleases/#helmrelease-status
- appVersion: 6.0.0
chartName: podinfo
chartVersion: 6.0.0
configDigest: sha256:abc123
deleted: "2024-01-01T10:00:00Z"
digest: sha256:def456
firstDeployed: "2024-01-01T09:00:00Z"
lastDeployed: "2024-01-01T10:00:00Z"
name: test-with-history
namespace: {{ .fluxns }}
status: superseded
version: 1
- appVersion: 6.1.0
chartName: podinfo
chartVersion: 6.1.0
configDigest: sha256:xyz789
deleted: null
digest: sha256:ghi012
firstDeployed: "2024-01-01T11:00:00Z"
lastDeployed: "2024-01-01T11:00:00Z"
name: test-with-history
namespace: {{ .fluxns }}
status: deployed
version: 2

@ -38,10 +38,55 @@ spec:
- kind: Secret - kind: Secret
name: test name: test
valuesKey: secrets.yaml valuesKey: secrets.yaml
- kind: Secret
name: test
valuesKey: flatValue
targetPath: aFlatValue
- kind: ConfigMap - kind: ConfigMap
name: none name: none
optional: true optional: true
--- ---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: test-with-history
namespace: {{ .fluxns }}
spec:
chartRef:
kind: OCIRepository
name: podinfo
interval: 5m0s
values:
image:
repository: stefanprodan/podinfo
tag: 5.0.0
status:
observedGeneration: 1
history:
- name: test-with-history
namespace: {{ .fluxns }}
version: 1
configDigest: sha256:abc123
chartName: podinfo
chartVersion: 6.0.0
appVersion: 6.0.0
deleted: "2024-01-01T10:00:00Z"
digest: sha256:def456
firstDeployed: "2024-01-01T09:00:00Z"
lastDeployed: "2024-01-01T10:00:00Z"
status: superseded
- name: test-with-history
namespace: {{ .fluxns }}
version: 2
configDigest: sha256:xyz789
chartName: podinfo
chartVersion: 6.1.0
appVersion: 6.1.0
digest: sha256:ghi012
firstDeployed: "2024-01-01T11:00:00Z"
lastDeployed: "2024-01-01T11:00:00Z"
status: deployed
---
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
@ -61,3 +106,4 @@ stringData:
secrets.yaml: | secrets.yaml: |
secret: "test" secret: "test"
override: "secret" override: "secret"
flatValue: some-flat-value

@ -1,3 +1,4 @@
aFlatValue: some-flat-value
cm: test cm: test
image: image:
repository: stefanprodan/podinfo repository: stefanprodan/podinfo

@ -6,7 +6,7 @@
► Secret/default/podinfo-token-77t89m9b67 drifted ► Secret/default/podinfo-token-77t89m9b67 drifted
data data
- one map entry removed: + one map entry added: - one map entry removed: + one map entry added:
drift-key: "*****" token: "*****" drift-key: "*****" token: "*****"
► Secret/default/db-user-pass-bkbd782d2c created ► Secret/default/db-user-pass-bkbd782d2c created

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save