Skip to content

Commit

Permalink
feat: New endpoint capable of serving directory listing or raw file, …
Browse files Browse the repository at this point in the history
…from non-archived or archived workflow (#8548)

Signed-off-by: Julie Vogelman <[email protected]>
  • Loading branch information
juliev0 committed May 2, 2022
1 parent 71e2073 commit 3d892d9
Show file tree
Hide file tree
Showing 16 changed files with 544 additions and 31 deletions.
28 changes: 17 additions & 11 deletions docs/fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ Workflow is the definition of a workflow resource

- [`artifactory-artifact.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifactory-artifact.yaml)

- [`artifacts-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflow.yaml)

- [`ci-output-artifact.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/ci-output-artifact.yaml)

- [`ci.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/ci.yaml)
Expand Down Expand Up @@ -392,6 +390,8 @@ WorkflowTemplate is the definition of a workflow template resource
<summary>Examples (click to open)</summary>
<br>

- [`artifacts-workflowtemplate.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflowtemplate.yaml)

- [`buildkit-template.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/buildkit-template.yaml)

- [`cron-backfill.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/cron-backfill.yaml)
Expand Down Expand Up @@ -439,7 +439,7 @@ WorkflowSpec is the specification of a Workflow.

- [`artifactory-artifact.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifactory-artifact.yaml)

- [`artifacts-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflow.yaml)
- [`artifacts-workflowtemplate.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflowtemplate.yaml)

- [`buildkit-template.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/buildkit-template.yaml)

Expand Down Expand Up @@ -861,7 +861,7 @@ CronWorkflowSpec is the specification of a CronWorkflow

- [`artifactory-artifact.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifactory-artifact.yaml)

- [`artifacts-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflow.yaml)
- [`artifacts-workflowtemplate.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflowtemplate.yaml)

- [`buildkit-template.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/buildkit-template.yaml)

Expand Down Expand Up @@ -1797,7 +1797,7 @@ Outputs hold parameters, artifacts, and results from a step

- [`artifactory-artifact.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifactory-artifact.yaml)

- [`artifacts-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflow.yaml)
- [`artifacts-workflowtemplate.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflowtemplate.yaml)

- [`ci-output-artifact.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/ci-output-artifact.yaml)

Expand Down Expand Up @@ -1907,7 +1907,7 @@ Artifact indicates an artifact to place at a specified path

- [`artifactory-artifact.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifactory-artifact.yaml)

- [`artifacts-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflow.yaml)
- [`artifacts-workflowtemplate.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflowtemplate.yaml)

- [`ci-output-artifact.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/ci-output-artifact.yaml)

Expand Down Expand Up @@ -2446,6 +2446,8 @@ _No description available_

- [`artifactory-artifact.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifactory-artifact.yaml)

- [`artifacts-workflowtemplate.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflowtemplate.yaml)

- [`daemon-nginx.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/daemon-nginx.yaml)

- [`daemon-step.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/daemon-step.yaml)
Expand Down Expand Up @@ -2544,6 +2546,8 @@ Inputs are the mechanism for passing parameters, artifacts, volumes from one tem

- [`artifactory-artifact.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifactory-artifact.yaml)

- [`artifacts-workflowtemplate.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflowtemplate.yaml)

- [`buildkit-template.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/buildkit-template.yaml)

- [`ci-output-artifact.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/ci-output-artifact.yaml)
Expand Down Expand Up @@ -3143,7 +3147,7 @@ ArchiveStrategy describes how to archive files/directory when saving artifacts

- [`artifact-passing-subpath.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifact-passing-subpath.yaml)

- [`artifacts-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflow.yaml)
- [`artifacts-workflowtemplate.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflowtemplate.yaml)

- [`map-reduce.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/map-reduce.yaml)

Expand Down Expand Up @@ -3266,6 +3270,8 @@ HTTPArtifact allows a file served on HTTP to be placed as an input artifact in a

- [`artifactory-artifact.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifactory-artifact.yaml)

- [`artifacts-workflowtemplate.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflowtemplate.yaml)

- [`daemon-nginx.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/daemon-nginx.yaml)

- [`daemon-step.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/daemon-step.yaml)
Expand Down Expand Up @@ -4070,7 +4076,7 @@ NoneStrategy indicates to skip tar process and upload the files or directory tre

- [`artifact-passing-subpath.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifact-passing-subpath.yaml)

- [`artifacts-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflow.yaml)
- [`artifacts-workflowtemplate.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflowtemplate.yaml)

- [`map-reduce.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/map-reduce.yaml)

Expand Down Expand Up @@ -4281,7 +4287,7 @@ ObjectMeta is metadata that all persisted resources must have, which includes al

- [`artifactory-artifact.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifactory-artifact.yaml)

- [`artifacts-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflow.yaml)
- [`artifacts-workflowtemplate.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflowtemplate.yaml)

- [`buildkit-template.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/buildkit-template.yaml)

Expand Down Expand Up @@ -4913,7 +4919,7 @@ A single application container that you want to run within a pod.

- [`artifactory-artifact.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifactory-artifact.yaml)

- [`artifacts-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflow.yaml)
- [`artifacts-workflowtemplate.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflowtemplate.yaml)

- [`buildkit-template.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/buildkit-template.yaml)

Expand Down Expand Up @@ -5574,7 +5580,7 @@ PersistentVolumeClaimSpec describes the common attributes of storage devices and

- [`artifactory-artifact.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifactory-artifact.yaml)

- [`artifacts-workflow.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflow.yaml)
- [`artifacts-workflowtemplate.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/artifacts-workflowtemplate.yaml)

- [`buildkit-template.yaml`](https://github.com/argoproj/argo-workflows/blob/master/examples/buildkit-template.yaml)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
apiVersion: argoproj.io/v1alpha1
kind: Workflow
kind: WorkflowTemplate
metadata:
generateName: artifacts-
name: artifacts
annotations:
workflows.argoproj.io/description: |
This workflows shows how to produce different types of output that are stored as the orginal file, rather than .tgz.
This example shows how to produce different types of output that are stored as the orginal file, rather than .tgz.
spec:
entrypoint: main
templates:
- name: main
inputs:
artifacts:
- name: index
path: /out/assets/argo.png
http:
url: https://raw.githubusercontent.com/argoproj/argo-workflows/master/docs/assets/argo.png
container:
image: argoproj/argosay:v2
command:
Expand All @@ -18,8 +24,21 @@ spec:
- |
mkdir /out
cowsay "hello world" > /out/hello.txt
echo '{"hello": {"world": true}}' > /out/hello.json
echo '<html><body><h1>Hello World</h1></body></html>' > /out/index.html
cat > /out/hello.json <<EOF
{"hello": {"world": true}}
EOF
echo '* {font-family: sans-serif}' > /out/assets/styles.css
cat > /out/index.html <<EOF
<html>
<head>
<link rel='stylesheet' href='assets/styles.css' type='text/css'/>
</head>
<body>
<h1>Hello World</h1>
<img src='assets/argo.png'/>
</body>
</html>
EOF
echo '<html><body><script>alert("XSS")</script></body></html>' > /out/xss.html
outputs:
artifacts:
Expand All @@ -30,18 +49,31 @@ spec:
key: hello.txt
archive:
none: { }
- name: png
path: /out/assets/argo.png
s3:
key: argo.png
archive:
none: { }
- name: json
path: /out/hello.json
s3:
key: hello.json
archive:
none: { }
- name: css
path: /out/assets/styles.css
s3:
key: styles.css
archive:
none: { }
- name: html
path: /out/index.html
s3:
key: index.html
archive:
none: { }
# this artifact tries to run javascript, in the UI this is prevented by our CSP sandbox
- name: xss
path: /out/xss.html
s3:
Expand All @@ -52,7 +84,7 @@ spec:
- name: dir
path: /out
s3:
key: dir
key: dir/
archive:
none: { }
# this will be a tgz with a single file
Expand Down
1 change: 1 addition & 0 deletions server/apiserver/argoserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ func (as *argoServer) newHTTPServer(ctx context.Context, port int, artifactServe
mux.HandleFunc("/input-artifacts/", artifactServer.GetInputArtifact)
mux.HandleFunc("/artifacts-by-uid/", artifactServer.GetOutputArtifactByUID)
mux.HandleFunc("/input-artifacts-by-uid/", artifactServer.GetInputArtifactByUID)
mux.HandleFunc("/artifact-files/", artifactServer.GetArtifactFile)
mux.Handle("/oauth2/redirect", handlers.ProxyHeaders(http.HandlerFunc(as.oAuth2Service.HandleRedirect)))
mux.Handle("/oauth2/callback", handlers.ProxyHeaders(http.HandlerFunc(as.oAuth2Service.HandleCallback)))
mux.HandleFunc("/metrics", func(w http.ResponseWriter, r *http.Request) {
Expand Down
Loading

0 comments on commit 3d892d9

Please sign in to comment.