Skip to content

Commit

Permalink
wget source component for downloading scan results
Browse files Browse the repository at this point in the history
  • Loading branch information
northdpole committed Feb 5, 2024
1 parent 9a3ed87 commit 6df5170
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 0 deletions.
14 changes: 14 additions & 0 deletions components/sources/fetch_scan_results/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
subinclude(
"///k8s//build/defs:k8s",
"//build/defs:buildkit",
"//build/defs:dracon",
)

dracon_component(
name = "source-fetch_scan_results",
images = [
"//third_party/docker/library/buildpack-dependencies/stable-curl",
],
task = "task.yaml",
visibility = ["//examples/pipelines/..."],
)
72 changes: 72 additions & 0 deletions components/sources/fetch_scan_results/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# DO NOT EDIT. Code generated by:
# github.com/ocurity/dracon//build/tools/kustomize-component-generator.

apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component
resources:
- task.yaml
patches:
# Add the Task to the Tekton Pipeline.
- patch: |
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: unused
spec:
workspaces:
- name: source-code-ws
tasks:
- name: wget
taskRef:
name: wget
workspaces:
- name: source-code-ws
workspace: source-code-ws
params:
- name: wget-url
value: $(params.wget-url)
- name: wget-options
value:
- $(params.wget-options)
- name: wget-filename
value: $(params.wget-filename)
params:
- name: wget-url
description: The url we want to download file from
type: string
default: ""
- name: wget-options
description: The arguments to pass to wget
type: array
default: []
- name: wget-filename
description: The filename we want to change our file to
type: string
default: ""
target:
kind: Pipeline
# Add anchors to Task.
- patch: |
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: wget
labels:
app.kubernetes.io/version: "0.6"
v1.dracon.ocurity.com/component: source
spec:
params:
- name: anchors
type: array
description: A list of tasks that this task depends on using their anchors.
default: []
results:
- name: anchor
description: An anchor to allow other tasks to depend on this task.
steps:
- name: anchor
image: docker.io/busybox:1.35.0
script: echo "$(context.task.name)" > "$(results.anchor.path)"
target:
kind: Task
name: wget
43 changes: 43 additions & 0 deletions components/sources/fetch_scan_results/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
# https://hub.tekton.dev/tekton/task/wget
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: wget
labels:
v1.dracon.ocurity.com/component: source
app.kubernetes.io/version: "0.6"
annotations:
tekton.dev/pipelines.minVersion: "0.29.0"
tekton.dev/platforms: "linux/amd64,linux/s390x,linux/ppc64le,linux/arm64"
tekton.dev/tags: download

spec:
description: >-
This source component is the dracon equivalent of the tekton wget component.
workspaces:
- name: source-code-ws
description: The generated file will be stored onto the volume backing this Workspace.
params:
- name: wget-url
description: The url we want to download file from
type: string
default: ""
- name: wget-options
description: The arguments to pass to wget
type: array
default: []
- name: wget-filename
description: The filename we want to change our file to
type: string
default: ""
steps:
- name: wget
image: "docker.io/library/buildpack-deps:stable-curl@sha256:3d5e59c47d5f82a769ad3f372cc9f86321e2e2905141bba974b75d3c08a53e8e"
command: [wget]
args:
[
"$(params.wget-options[*])",
"$(params.wget-url)",
"$(workspaces.source-code-ws.path)/$(params.filename)",
]

0 comments on commit 6df5170

Please sign in to comment.