Skip to content

Commit

Permalink
Support for git/http input artifacts. hack together wait container lo…
Browse files Browse the repository at this point in the history
…gic as a shell script
  • Loading branch information
jessesuen committed Nov 8, 2017
1 parent de71cb5 commit 738b02d
Show file tree
Hide file tree
Showing 30 changed files with 362 additions and 172 deletions.
2 changes: 1 addition & 1 deletion Dockerfile-argoexec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM debian:9.1

RUN apt-get update && \
apt-get install -y curl jq procps && \
apt-get install -y curl jq procps git && \
rm -rf /var/lib/apt/lists/* && \
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && \
chmod +x ./kubectl && \
Expand Down
12 changes: 9 additions & 3 deletions api/workflow/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package v1

import (
"fmt"

apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
Expand Down Expand Up @@ -89,6 +90,10 @@ type Artifact struct {
Name string `json:"name"`
// Path is the container path to the artifact
Path string `json:"path,omitempty"`

// mode bits to use on this file, must be a value between 0 and 0777
Mode *int32 `json:"mode,omitempty"`

// From allows an artifact to reference an artifact from a previous step
From string `json:"from,omitempty"`
S3 *S3Artifact `json:"s3,omitempty"`
Expand Down Expand Up @@ -193,9 +198,10 @@ type S3Artifact struct {
}

type GitArtifact struct {
URL string `json:"url"`
UsernameSecret *apiv1.SecretKeySelector `json:"usernameSecret"`
PasswordSecret *apiv1.SecretKeySelector `json:"passwordSecret"`
Repo string `json:"repo"`
Revision string `json:"revision,omitempty"`
UsernameSecret *apiv1.SecretKeySelector `json:"usernameSecret,omitempty"`
PasswordSecret *apiv1.SecretKeySelector `json:"passwordSecret,omitempty"`
}

type HTTPArtifact struct {
Expand Down
19 changes: 10 additions & 9 deletions examples/arguments-artifacts.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
apiVersion: argoproj.io/v1
kind: Workflow
metadata:
generateName: argo-wf-
generateName: arguments-artifacts-
spec:
entrypoint: artifact-argument-example
entrypoint: kubectl-input-artifact
arguments:
artifacts:
- name: CODE
- name: kubectl
http:
url: https://mycompany.com/files/foo
url: https://storage.googleapis.com/kubernetes-release/release/v1.8.0/bin/linux/amd64/kubectl

templates:
- name: artifact-argument-example
- name: kubectl-input-artifact
inputs:
artifacts:
- name: CODE
path: /src
- name: kubectl
path: /usr/local/bin/kubectl
mode: 755
container:
image: debian:latest
image: debian:9.1
command: [sh, -c]
args: ["cd /src && ls -l"]
args: ["kubectl version"]
12 changes: 6 additions & 6 deletions examples/arguments-parameters.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
apiVersion: argoproj.io/v1
kind: Workflow
metadata:
generateName: argo-wf-
generateName: arguments-parameters-
spec:
entrypoint: cowsay
entrypoint: whalesay
arguments:
parameters:
- name: MESSAGE
- name: message
value: hello world

templates:
- name: cowsay
- name: whalesay
inputs:
parameters:
- name: MESSAGE
- name: message
container:
image: docker/whalesay:latest
command: [cowsay]
args: ["{{inputs.parameters.MESSAGE}}"]
args: ["{{inputs.parameters.message}}"]
20 changes: 10 additions & 10 deletions examples/artifact-passing.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
apiVersion: argoproj.io/v1
kind: Workflow
metadata:
generateName: argo-wf-
generateName: artifact-passing-
spec:
entrypoint: artifact-example
templates:
- name: artifact-example
steps:
- - name: COWSAY
template: cowsay
- - name: PRINT
- - name: generate-artifact
template: whalesay
- - name: consume-artifact
template: print-message
arguments:
artifacts:
- name: MESSAGE
from: "{{steps.COWSAY.outputs.artifacts.MESSAGE}}"
- name: message
from: "{{steps.generate-artifact.outputs.artifacts.hello-art}}"

- name: cowsay
- name: whalesay
container:
image: docker/whalesay:latest
command: [sh, -c]
args: ["cowsay hello world | tee /tmp/hello_world.txt"]
outputs:
artifacts:
- name: MESSAGE
- name: hello-art
path: /tmp/hello_world.txt

- name: print-message
inputs:
artifacts:
- name: MESSAGE
- name: message
path: /tmp/message
container:
image: alpine:latest
command: [sh, -c]
args: ["cat /tmp/message; sleep 999999"]
args: ["cat /tmp/message"]
14 changes: 7 additions & 7 deletions examples/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: argoproj.io/v1
kind: Workflow
metadata:
generateName: argo-wf-
generateName: ci-example-
spec:
entrypoint: ci-example
volumeClaimTemplates:
Expand All @@ -16,17 +16,17 @@ spec:
- name: ci-example
steps:
- - name: build
template: build
template: build-golang-example
- - name: test
template: test
template: run-hello

- name: build
- name: build-golang-example
inputs:
artifacts:
- name: CODE
path: /go/src/github.com/golang/example
git:
url: https://github.com/golang/example.git
repo: https://github.com/golang/example.git
container:
image: golang:1.8
command: [sh, -c]
Expand All @@ -38,11 +38,11 @@ spec:
- name: workdir
mountPath: /go
- name: test
- name: run-hello
container:
image: debian:9.1
command: [sh, -c]
args: ["/go/src/github.com/golang/example/hello/hello ; sleep 9999; echo done"]
args: ["/go/src/github.com/golang/example/hello/hello"]
volumeMounts:
- name: workdir
mountPath: /go
2 changes: 1 addition & 1 deletion examples/coinflip.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: argoproj.io/v1
kind: Workflow
metadata:
generateName: argo-wf-
generateName: coinflip-
spec:
entrypoint: coinflip
templates:
Expand Down
7 changes: 4 additions & 3 deletions examples/conditionals.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
apiVersion: argoproj.io/v1
kind: Workflow
metadata:
generateName: argo-wf-
generateName: conditional-
spec:
entrypoint: conditional-example
arguments:
parameters:
- name: should-print
value: "false"

templates:
- name: conditional-example
inputs:
parameters:
- name: should-print
steps:
- - name: print-hello
template: cowsay
template: whalesay
when: "{{inputs.parameters.should-print}} == true"

- name: cowsay
- name: whalesay
container:
image: docker/whalesay:latest
command: [sh, -c]
Expand Down
6 changes: 3 additions & 3 deletions examples/hello-world.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apiVersion: argoproj.io/v1
kind: Workflow
metadata:
generateName: argo-wf-
generateName: hello-world-
spec:
entrypoint: cowsay
entrypoint: whalesay
templates:
- name: cowsay
- name: whalesay
container:
image: docker/whalesay:latest
command: [cowsay]
Expand Down
9 changes: 5 additions & 4 deletions examples/input-artifact-git.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
apiVersion: argoproj.io/v1
kind: Workflow
metadata:
generateName: argo-wf-
generateName: input-artifact-git-
spec:
entrypoint: git-clone
templates:
- name: git-clone
inputs:
artifacts:
- name: CODE
- name: argo-source
path: /src
git:
url: https://github.com/argoproj/argo.git
repo: https://github.com/argoproj/argo.git
revision: "2.0"
container:
image: golang:1.8
command: [sh, -c]
args: ["cd /src; git status"]
args: ["cd /src && git status && ls -l"]
13 changes: 7 additions & 6 deletions examples/input-artifact-http.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
apiVersion: argoproj.io/v1
kind: Workflow
metadata:
generateName: argo-wf-
generateName: input-artifact-http-
spec:
entrypoint: http-artifact-example
templates:
- name: http-artifact-example
inputs:
artifacts:
- name: CODE
path: /bin/foo
- name: kubectl
path: /bin/kubectl
mode: 755
http:
url: https://mycompany.com/files/foo
url: https://storage.googleapis.com/kubernetes-release/release/v1.8.0/bin/linux/amd64/kubectl
container:
image: alpine:latest
image: debian:9.1
command: [sh, -c]
args: ["/bin/foo"]
args: ["kubectl version"]
15 changes: 8 additions & 7 deletions examples/loops-maps.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
apiVersion: argoproj.io/v1
kind: Workflow
metadata:
generateName: argo-wf-
generateName: loops-maps-
spec:
entrypoint: loop-map-example
templates:
- name: loop-map-example
steps:
- PRINT-OS:
- - name: test-linux
template: cat-os-release
arguments:
parameters:
- name: IMAGE
- name: image
value: "{{item.image}}"
- name: TAG
- name: tag
value: "{{item.tag}}"
withItems:
- { image: 'debian', tag: '9.1' }
- { image: 'debian', tag: '8.9' }
- { image: 'alpine', tag: '3.6' }
- { image: 'ubuntu', tag: '17.10' }

- name: cat-os-release
inputs:
parameters:
- name: IMAGE
- name: TAG
- name: image
- name: tag
container:
image: "{{inputs.parameters.IMAGE}}:{{inputs.parameters.TAG}}"
image: "{{inputs.parameters.image}}:{{inputs.parameters.tag}}"
command: [cat]
args: [/etc/os-release]
14 changes: 7 additions & 7 deletions examples/loops.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
apiVersion: argoproj.io/v1
kind: Workflow
metadata:
generateName: argo-wf-
generateName: loops-
spec:
entrypoint: loop-example
templates:
- name: loop-example
steps:
- COWSAY:
template: cowsay
- - name: print-message
template: whalesay
arguments:
parameters:
- name: MESSAGE
- name: message
value: "{{item}}"
withItems:
- hello world
- goodbye world

- name: cowsay
- name: whalesay
inputs:
parameters:
- name: MESSAGE
- name: message
container:
image: docker/whalesay:latest
command: [cowsay]
args: ["{{inputs.parameters.MESSAGE}}"]
args: ["{{inputs.parameters.message}}"]
Loading

0 comments on commit 738b02d

Please sign in to comment.