Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

56 Commits

Repository files navigation

Publish Docker image

Update Kustomization

An CI image for updating image tags using kustomize.

Drone plugin settings (when used without Drone please add PLUGIN_ as the environment variable prefix):

  • GIT_TOKEN: Personal Access Token from Gitea or GitHub, etc.
  • SSH_KEY: Base64-encoded private ssh key of MANIFEST_USER
  • MANIFEST_HOST: Manifest git server host
  • MANIFEST_USER: Manifest git user name
  • MANIFEST_USER_EMAIL: Manifest git user email
  • MANIFEST_NAMESPACE: Manifest git repository namespace or organization name
  • MANIFEST_REPO: Manifest git repository
  • MANIFEST_BRANCH: Manifest repository branch
  • IMAGES: Updated images (comma-separated list)
  • IMAGE_TAG: Image tag generated in current build
  • KUSTOMIZATION: Kustomization path relative to the project root

Drone Usage Example

kind: pipelinename: publish-mysvc1steps:
- name: publishimage: plugins/dockersettings:
context: mysvc1dockerfile: mysvc1/Dockerfileusername:
from_secret: docker_usernamepassword:
from_secret: docker_passwordregistry: harbor.mycompany.comrepo: harbor.mycompany.com/myuser/mysvc1tags:
- ${DRONE_COMMIT_BRANCH}-${DRONE_COMMIT_SHA:0:7}
- latestwhen:
event: push
---
kind: pipelinename: publish-mysvc2steps:
- name: publishimage: plugins/dockersettings:
context: mysvc2dockerfile: mysvc2/Dockerfileusername:
from_secret: docker_usernamepassword:
from_secret: docker_passwordregistry: harbor.mycompany.comrepo: harbor.mycompany.com/myuser/mysvc2tags:
- ${DRONE_COMMIT_BRANCH}-${DRONE_COMMIT_SHA:0:7}
- latestwhen:
event: push
---
kind: pipelinename: update-kustomizationsteps:
- name: kustomizationpull: if-not-existsimage: andyhan/update-kustomizationsettings:
GIT_TOKEN:
from_secret: git_token_ci_robotMANIFEST_HOST: git.mycompany.comMANIFEST_USER: myuserMANIFEST_USER_EMAIL: myuser@mycompany.comMANIFEST_NAMESPACE: myuserMANIFEST_REPO: myapp-manifestsMANIFEST_BRANCH: mainIMAGES: harbor.mycompany.com/myuser/mysvc1,harbor.mycompany.com/myuser/mysvc2IMAGE_TAG: ${DRONE_COMMIT_BRANCH}-${DRONE_COMMIT_SHA:0:7}KUSTOMIZATION: overlays/productionwhen:
event: pushdepends_on:
- publish-mysvc1
- publish-mysvc2

In the above example, the image tag is in the form of ${DRONE_COMMIT_BRANCH}-${DRONE_COMMIT_SHA:0:7}, where DRONE_COMMIT_BRANCH and DRONE_COMMIT_SHA are environment variables provided by Drone at run time.

About

A CI plugin for updating image tags with kustomize.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages