Skip to content

Instantly share code, notes, and snippets.

@edib
Created March 14, 2023 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edib/2d15be42ce7d5465403d3dbc433ad5c1 to your computer and use it in GitHub Desktop.
Save edib/2d15be42ce7d5465403d3dbc433ad5c1 to your computer and use it in GitHub Desktop.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
name: build-and-push
spec:
entrypoint: build-and-push
templates:
- name: build-and-push
steps:
- - name: checkout
uses: argoproj/checkout@v2
with:
path: app
ssh-private-key: |
{{- requiredSecret "ssh-key" "git-ssh-key" | sshPrivateKey }}
- - name: build
container:
image: maven:3.8.4-jdk-11
command:
- mvn
- clean
- package
workingDir: /app
artifactRepository:
s3:
bucket: my-bucket
keyPrefix: artifacts/{{workflow.name}}/{{pod.name}}/
endpoint: s3.my-company.com
accessKeySecret:
name: s3-access-key
key: accesskey
secretKeySecret:
name: s3-secret-key
key: secretkey
outputs:
artifacts:
- name: app-jar
path: /app/target/*.jar
- - name: push
container:
image: docker:20.10.11
command:
- docker
- login
- -u
- _json_key
- --password-stdin
- my-container-registry.com
env:
GOOGLE_APPLICATION_CREDENTIALS: /secrets/registry-auth.json
volumeMounts:
- name: registry-auth
mountPath: /secrets
inputs:
artifacts:
- name: app-jar
path: /app/target/*.jar
command:
- docker
- build
- --build-arg
- JAR_FILE=app.jar
- -t
- my-container-registry.com/my-image:{{workflow.name}}-{{pod.name}}
- .
output:
artifacts:
- name: image
path: my-container-registry.com/my-image:{{workflow.name}}-{{pod.name}}
volumes:
- name: registry-auth
secret:
secretName: registry-auth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment