GitHub Action
Run kustomize to update images and push result to another repository
Useful to push images updates to a master repository containing central manifests.
If you are using Kubernetes, usually, after building and pushing a Docker image to it's registry you will probably need to push that new tag to the repository that has all your manifest.
- Clones the central repository
- Runs: kustomize edit set image
- Pushes the resulted manifest to the central repository
There are different variables to setup the action:
Kustomize version to use. If not set the latest available will be use. Check https://github.com/kubernetes-sigs/kustomize/releases for available versions
The images (space separated) to edit using kustomize. For example: node:8.15.0 mysql=mariadb For more information run: kustomize edit set image -h
The email that will be used for the commit in the destination-repository-name.
The name that will be used for the commit in the destination-repository-name. If not specified, the repository-username
will be used instead.
The repository we will push the kustomize results to.
For the repository https://github.com/rusowyler/github-action-kustomize-and-push
is rusowyler
.
For the repository https://github.com/rusowyler/github-action-kustomize-and-push
is github-action-kustomize-and-push
The branch name for the destination repository. It defaults to main
.
The directory to wipe and replace in the target repository. Defaults to wiping the entire repository
The commit message to be used. Defaults to "Updated KUSTOMIZE_IMAGES from ORIGIN_COMMIT". ORIGIN_COMMIT and KUSTOMIZE_IMAGES are replaced by the URL@commit and the submited images
E.g.:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
Generate your personal token following the steps:
- Go to the Github Settings (on the right hand side on the profile picture)
- On the left hand side pane click on "Developer Settings"
- Click on "Personal Access Tokens" (also available at https://github.com/settings/tokens)
- Generate a new token, choose "Repo". Copy the token.
Then make the token available to the Github Action following the steps:
- Go to the Github page for the repository that you push from, click on "Settings"
- On the left hand side pane click on "Secrets"
- Click on "Add a new secret" and name it "API_TOKEN_GITHUB"
- name: Kustomize and push
uses: rusowyler/github-action-kustomize-and-push@main
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
with:
kustomize-edit-images: "node:8.15.0"
repository-username: "rusowyler"
repository-name: "central-k8s-repository"
user-email: [email protected]
directory: enviroment/qa
- Add real world examples
- Add a working example