mirror of
https://github.com/fluxcd/flux2.git
synced 2026-02-08 00:37:27 +00:00
Merge pull request #535 from fluxcd/gh-action-auto-updates
Automate Flux upgrades with GitHub Actions
This commit is contained in:
commit
128d23720f
2 changed files with 60 additions and 1 deletions
|
|
@ -1,6 +1,57 @@
|
|||
# Flux GitHub Action
|
||||
|
||||
Example workflow:
|
||||
Usage:
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- name: Setup Flux CLI
|
||||
uses: fluxcd/flux2/action@main
|
||||
- name: Run Flux commands
|
||||
run: flux -v
|
||||
```
|
||||
|
||||
### Automate Flux updates
|
||||
|
||||
Example workflow for updating Flux's components generated with `flux bootstrap --arch=amd64 --path=clusters/production`:
|
||||
|
||||
```yaml
|
||||
name: update-flux
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 * * * *"
|
||||
|
||||
jobs:
|
||||
components:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup Flux CLI
|
||||
uses: fluxcd/flux2/action@main
|
||||
- name: Check for updates
|
||||
id: update
|
||||
run: |
|
||||
flux install --arch=amd64 \
|
||||
--export > ./clusters/production/flux-system/gotk-components.yaml
|
||||
|
||||
VERSION="$(flux -v)"
|
||||
echo "::set-output name=flux_version::$VERSION"
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: update-flux
|
||||
commit-message: Update to ${{ steps.update.outputs.flux_version }}
|
||||
title: Update to ${{ steps.update.outputs.flux_version }}
|
||||
body: |
|
||||
${{ steps.update.outputs.flux_version }}
|
||||
```
|
||||
|
||||
### End-to-end testing
|
||||
|
||||
Example workflow for running Flux in Kubernetes Kind:
|
||||
|
||||
```yaml
|
||||
name: e2e
|
||||
|
|
@ -23,3 +74,6 @@ jobs:
|
|||
- name: Install Flux in Kubernetes Kind
|
||||
run: flux install
|
||||
```
|
||||
|
||||
A complete e2e testing workflow is available here
|
||||
[flux2-kustomize-helm-example](https://github.com/fluxcd/flux2-kustomize-helm-example/blob/main/.github/workflows/e2e.yaml)
|
||||
|
|
|
|||
|
|
@ -524,6 +524,11 @@ Verify that the controllers have been upgrade with:
|
|||
flux check
|
||||
```
|
||||
|
||||
!!! hint "Automated upgrades"
|
||||
You can automate the components manifest update with GitHub Actions
|
||||
and open a PR when there is a new Flux version available.
|
||||
For more details please see [Flux GitHub Action docs](https://github.com/fluxcd/flux2/tree/main/action).
|
||||
|
||||
### Terraform upgrade
|
||||
|
||||
Update the Flux provider to the [latest release](https://github.com/fluxcd/terraform-provider-flux/releases)
|
||||
|
|
|
|||
Loading…
Reference in a new issue