GitHub Action
k install
Installs and configures k inside GitHub actions.
gitops-repository-url
- The URL for your GitOps repository. Include a Personal Access Token in the userinfo part of the URL. Eg. https://<personal-access-token>@github.com/<organization>/<repository>
.
kube-config
- A Base64 encoded string containing a full kubectl
configuration YAML payload with access to the Kubernetes repository you want k
to interact with. Eg. Linux: cat ~/.kube/config | base64
(on Linux add the --wrap 0
argument to avoid newlines).
kube-config
- The name of the kubectl
context to use. Defaults to the current context as set in kube-config
.
registry
- The host of the Docker registry. Eg. docker.io
, ghcr.io
etc. Note: If you're running commands relying on docker
, you might want to use another Github action to login to your registry.
registry-namespace
- The namespace (aka. user / organisation) on the Docker registry. Ie. the path that goes in between the registry host and the repository name of your Docker images.
Example of running k deploy
to deploy the current git-sha of the checked out repository to <application-name>
.
Assumes you have a GITOPS_REPOSITORY_URL
secret containing your GitOps repo URL (including a personal access token as basic auth) and a KUBE_CONFIG
secret containing a Base64 encoded dump of a kubectl
config file with access to your Kubernetes cluster.
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: reclaim-the-stack/k-action@master
with:
gitops-repository-url: ${{ secrets.GITOPS_REPOSITORY_URL }}
kube-config: ${{ secrets.KUBE_CONFIG }}
- uses: actions/checkout@v3
- run: k deploy <application-name> --disable-image-verification