Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
flux2
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
fluxcd
flux2
Commits
d4c5a137
Unverified
Commit
d4c5a137
authored
2 years ago
by
Stefan Prodan
Browse files
Options
Downloads
Patches
Plain Diff
Add examples for pushing artifacts with GH Actions
Signed-off-by:
Stefan Prodan
<
stefan.prodan@gmail.com
>
parent
d4718f6f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
action/README.md
+81
-1
81 additions, 1 deletion
action/README.md
with
81 additions
and
1 deletion
action/README.md
+
81
−
1
View file @
d4c5a137
...
@@ -32,7 +32,7 @@ You can download a specific version with:
...
@@ -32,7 +32,7 @@ You can download a specific version with:
-
name
:
Setup Flux CLI
-
name
:
Setup Flux CLI
uses
:
fluxcd/flux2/action@main
uses
:
fluxcd/flux2/action@main
with
:
with
:
version
:
0.
8
.0
version
:
0.
32
.0
```
```
### Automate Flux updates
### Automate Flux updates
...
@@ -74,6 +74,86 @@ jobs:
...
@@ -74,6 +74,86 @@ jobs:
${{ steps.update.outputs.flux_version }}
${{ steps.update.outputs.flux_version }}
```
```
### Push Kubernetes manifests to container registries
Example workflow for publishing Kubernetes manifests bundled as OCI artifacts to GitHub Container Registry:
```
yaml
name
:
push-artifact-staging
on
:
push
:
branches
:
-
'
main'
permissions
:
packages
:
write
# needed for ghcr.io access
env
:
OCI_REPO
:
"
oci://ghcr.io/my-org/manifests/${{
github.event.repository.name
}}"
jobs
:
kubernetes
:
runs-on
:
ubuntu-latest
steps
:
-
name
:
Checkout
uses
:
actions/checkout@v2
-
name
:
Setup Flux CLI
uses
:
fluxcd/flux2/action@main
-
name
:
Generate manifests
run
:
|
kustomize build ./manifests/staging > ./deploy/app.yaml
-
name
:
Push manifests
run
:
|
flux push artifact $OCI_REPO:$(git rev-parse --short HEAD) \
--path="./deploy" \
--source="$(git config --get remote.origin.url)" \
--revision="$(git branch --show-current)/$(git rev-parse HEAD)"
-
name
:
Deploy manifests to staging
run
:
|
flux tag artifact $OCI_REPO:$(git rev-parse --short HEAD) --tag staging
```
Example workflow for publishing Kubernetes manifests bundled as OCI artifacts to Docker Hub:
```
yaml
name
:
push-artifact-production
on
:
push
:
tags
:
-
'
*'
env
:
OCI_REPO
:
"
oci://docker.io/my-org/app-config"
jobs
:
kubernetes
:
runs-on
:
ubuntu-latest
steps
:
-
name
:
Checkout
uses
:
actions/checkout@v2
-
name
:
Setup Flux CLI
uses
:
fluxcd/flux2/action@main
-
name
:
Login to Docker Hub
uses
:
docker/login-action@v2
with
:
username
:
${{ secrets.DOCKER_USERNAME }}
password
:
${{ secrets.DOCKER_PASSWORD }}
-
name
:
Generate manifests
run
:
|
kustomize build ./manifests/production > ./deploy/app.yaml
-
name
:
Push manifests
run
:
|
flux push artifact $OCI_REPO:$(git tag --points-at HEAD) \
--path="./deploy" \
--source="$(git config --get remote.origin.url)" \
--revision="$(git tag --points-at HEAD)/$(git rev-parse HEAD)"
-
name
:
Deploy manifests to production
run
:
|
flux tag artifact $OCI_REPO:$(git tag --points-at HEAD) --tag production
```
### End-to-end testing
### End-to-end testing
Example workflow for running Flux in Kubernetes Kind:
Example workflow for running Flux in Kubernetes Kind:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment