Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fluxcd/fluxctl-action
A GitHub Action to run fluxctl commands
https://github.com/fluxcd/fluxctl-action
github-actions gitops
Last synced: about 1 month ago
JSON representation
A GitHub Action to run fluxctl commands
- Host: GitHub
- URL: https://github.com/fluxcd/fluxctl-action
- Owner: fluxcd
- License: apache-2.0
- Archived: true
- Created: 2020-03-28T10:46:10.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-11-18T13:13:57.000Z (about 4 years ago)
- Last Synced: 2024-11-13T01:22:37.577Z (about 1 month ago)
- Topics: github-actions, gitops
- Language: Shell
- Homepage: https://docs.fluxcd.io/en/latest/references/fluxctl/
- Size: 13.7 KB
- Stars: 15
- Watchers: 5
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fluxctl-action
[![e2e](https://github.com/fluxcd/fluxctl-action/workflows/e2e/badge.svg)](https://github.com/fluxcd/fluxctl-action/actions)
A GitHub Action to run fluxctl [commands](https://docs.fluxcd.io/en/latest/references/fluxctl/).
## Usage
In order to use fluxctl in GitHub Actions you have to install kubectl on the GitHub Action runner and
setup the current context to a Kubernetes cluster where Flux is running.```yaml
name: Synchronize clusteron: push
jobs:
fluxctl:
runs-on: ubuntu-latest
steps:
- uses: azure/setup-kubectl@v1
- uses: azure/k8s-set-context@v1
with:
method: kubeconfig
kubeconfig:
- name: Setup fluxctl
uses: fluxcd/fluxctl-action@master
- name: Synchronize cluster
env:
FLUX_FORWARD_NAMESPACE: flux
run: fluxctl sync
```## Kubernetes Kind
You can use the fluxctl GitHub Action together with Kubernetes Kind to build an end-to-end testing pipeline
for the git repository that defines your cluster desired state.```yaml
name: e2eon: push
jobs:
fluxctl:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Kubernetes
uses: engineerd/[email protected]
- name: Setup fluxctl
uses: fluxcd/fluxctl-action@master
- name: Install Flux
run: |
kubectl create ns flux
fluxctl install \
--git-path=test \
--git-branch=${GITHUB_REF#refs/heads/} \
--git-readonly=true \
--registry-disable-scanning=true \
[email protected] \
--git-url=https://github.com/fluxcd/fluxctl-action.git \
--namespace=flux | kubectl apply -f -
- name: Verify install
run: kubectl -n flux rollout status deploy/flux --timeout=1m
- name: Sync git with cluster
env:
FLUX_FORWARD_NAMESPACE: flux
run: fluxctl sync
- name: Verify sync
run: kubectl get ns | grep test
```Note that we set `--git-branch=${GITHUB_REF#refs/heads/}` so that Flux will sync the current branch.
If the git repository is not public, then you have to configure Flux with a
[personal access token](https://docs.fluxcd.io/en/latest/guides/use-git-https/)
so that it can synchronize the repo over HTTPS.