|
| 1 | +kind: Workflow |
| 2 | +apiVersion: v1 |
| 3 | +metadata: |
| 4 | + generateName: git-ghost-argo-example- |
| 5 | + labels: |
| 6 | + app: git-ghost-argo-example |
| 7 | +spec: |
| 8 | + arguments: |
| 9 | + parameters: |
| 10 | + - name: image-prefix |
| 11 | + globalName: image-prefix |
| 12 | + - name: image-tag |
| 13 | + globalName: image-tag |
| 14 | + - name: git-repo |
| 15 | + globalName: git-repo |
| 16 | + - name: git-ghost-repo |
| 17 | + globalName: git-ghost-repo |
| 18 | + - name: git-ghost-registry |
| 19 | + globalName: git-ghost-registry |
| 20 | + - name: git-commit-hash |
| 21 | + globalName: git-commit-hash |
| 22 | + - name: diff-hash |
| 23 | + globalName: diff-hash |
| 24 | + entrypoint: steps |
| 25 | + templates: |
| 26 | + - name: steps |
| 27 | + steps: |
| 28 | + - - name: build-image |
| 29 | + template: build-image |
| 30 | + - - name: job |
| 31 | + template: job |
| 32 | + - name: build-image |
| 33 | + initContainers: |
| 34 | + - name: init |
| 35 | + image: "{{workflow.parameters.image-prefix}}git-ghost-cli:{{workflow.parameters.image-tag}}" |
| 36 | + imagePullPolicy: IfNotPresent |
| 37 | + command: ["bash"] |
| 38 | + args: |
| 39 | + - "-c" |
| 40 | + - "git clone {{workflow.parameters.git-repo}} . && git checkout {{workflow.parameters.git-commit-hash}} && git ghost pull -v {{workflow.parameters.git-commit-hash}} {{workflow.parameters.diff-hash}}" |
| 41 | + workingDir: /workspace |
| 42 | + env: |
| 43 | + - name: GIT_SSH_COMMAND |
| 44 | + value: "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /etc/git-secret/sshkey" |
| 45 | + - name: GIT_GHOST_REPO |
| 46 | + value: "{{workflow.parameters.git-ghost-repo}}" |
| 47 | + mirrorVolumeMounts: true |
| 48 | + container: |
| 49 | + name: kaniko |
| 50 | + image: gcr.io/kaniko-project/executor:v0.9.0 |
| 51 | + imagePullPolicy: IfNotPresent |
| 52 | + args: |
| 53 | + - --context=/workspace |
| 54 | + - --dockerfile=/workspace/examples/argo/Dockerfile |
| 55 | + - --destination={{workflow.parameters.git-ghost-registry}}:{{workflow.parameters.git-commit-hash}}-{{workflow.parameters.diff-hash}} |
| 56 | + volumeMounts: |
| 57 | + - name: code |
| 58 | + mountPath: /workspace |
| 59 | + - name: git-secret |
| 60 | + mountPath: /etc/git-secret |
| 61 | + - name: docker-cred |
| 62 | + mountPath: /root |
| 63 | + volumes: |
| 64 | + - name: code |
| 65 | + emptyDir: |
| 66 | + - name: git-secret |
| 67 | + secret: |
| 68 | + secretName: git-ghost-git-cred |
| 69 | + defaultMode: 256 |
| 70 | + - name: docker-cred |
| 71 | + projected: |
| 72 | + sources: |
| 73 | + - secret: |
| 74 | + name: git-ghost-docker-cred |
| 75 | + items: |
| 76 | + - key: .dockerconfigjson |
| 77 | + path: .docker/config.json |
| 78 | + - name: job |
| 79 | + metadata: |
| 80 | + labels: |
| 81 | + git-commit-hash: "{{workflow.parameters.git-commit-hash}}" |
| 82 | + diff-hash: "{{workflow.parameters.diff-hash}}" |
| 83 | + container: |
| 84 | + image: "{{workflow.parameters.git-ghost-registry}}:{{workflow.parameters.git-commit-hash}}-{{workflow.parameters.diff-hash}}" |
| 85 | + command: ["git"] |
| 86 | + args: |
| 87 | + - diff |
| 88 | + - HEAD |
| 89 | + imagePullSecrets: |
| 90 | + - name: git-ghost-docker-cred |
0 commit comments