@@ -3,17 +3,18 @@ A Drone CI plugin for updating an image tag using kustomize.
33
44Environment variables:
55- ` SSH_KEY ` : Base64-encoded private key of your manifest repo
6- - ` MANIFEST_HOST ` : Git server host
7- - ` MANIFEST_USER ` : Git user
8- - ` MANIFEST_REPO ` : Git repository
9- - ` IMAGE_REPO ` : Image repository
6+ - ` MANIFEST_HOST ` : Manifest git server host
7+ - ` MANIFEST_USER ` : Manifest git user
8+ - ` MANIFEST_REPO ` : Manifest git repository
9+ - ` MANIFEST_BRANCH ` : Manifest repository branch
10+ - ` IMAGES ` : Updated images (comma-separated list)
1011- ` IMAGE_TAG ` : Image tag generated in current build
11- - ` SVC_PATH ` : Service kustomization path relative to the project root
12+ - ` KUSTOMIZATION ` : Kustomization path relative to the project root
1213
1314Example usage in a Drone pipeline:
1415``` yaml
1516...
16- - name : push-registry
17+ - name : publish-mysvc1
1718 image : plugins/docker
1819 settings :
1920 context : .
@@ -23,27 +24,45 @@ Example usage in a Drone pipeline:
2324 password :
2425 from_secret : docker_password
2526 registry : harbor.mycompany.com
26- repo : harbor.mycompany.com/myuser/mysvc
27+ repo : harbor.mycompany.com/myuser/mysvc1
28+ tags :
29+ - ${DRONE_COMMIT_BRANCH}-${DRONE_COMMIT_SHA:0:7}
30+ - latest
31+ when :
32+ event : push
33+ - name : publish-mysvc2
34+ image : plugins/docker
35+ settings :
36+ context : .
37+ dockerfile : ./Dockerfile
38+ username :
39+ from_secret : docker_username
40+ password :
41+ from_secret : docker_password
42+ registry : harbor.mycompany.com
43+ repo : harbor.mycompany.com/myuser/mysvc2
2744 tags :
2845 - ${DRONE_COMMIT_BRANCH}-${DRONE_COMMIT_SHA:0:7}
2946 - latest
3047 when :
3148 event : push
3249- name : update-kustomization
3350 pull : if-not-exists
34- image : minghsu0107/update-kustomization:v1.0.2
51+ image : minghsu0107/update-kustomization:v1.0.3
3552 environment :
3653 SSH_KEY :
3754 from_secret : ssh_key
3855 MANIFEST_HOST : git.mycompany.com
3956 MANIFEST_USER : myuser
4057 MANIFEST_REPO : mysvc
41- IMAGE_REPO : harbor.mycompany.com/myuser/mysvc
58+ MANIFEST_BRANCH : ${DRONE_COMMIT_BRANCH}
59+ IMAGES : harbor.mycompany.com/myuser/mysvc1,harbor.mycompany.com/myuser/mysvc2
4260 IMAGE_TAG : ${DRONE_COMMIT_BRANCH}-${DRONE_COMMIT_SHA:0:7}
43- SVC_PATH : staging/mysvc
61+ KUSTOMIZATION : staging/mysvc
4462 when :
4563 event : push
4664 depends_on :
47- - push-registry
65+ - publish-mysvc1
66+ - publish-mysvc2
4867` ` `
4968In 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.
0 commit comments