3 changed files with 140 additions and 49 deletions
@ -0,0 +1,103 @@
|
||||
apiVersion: tekton.dev/v1beta1 |
||||
kind: Task |
||||
metadata: |
||||
name: osh-scan-scm-task |
||||
spec: |
||||
stepTemplate: |
||||
env: |
||||
- name: "HOME" |
||||
value: "/tekton/home" |
||||
|
||||
params: |
||||
- name: repo-url |
||||
type: string |
||||
description: The SCMURL |
||||
|
||||
- name: revision |
||||
type: string |
||||
description: The revision or tag |
||||
|
||||
- name: mock-build-params |
||||
type: string |
||||
description: Parameters pushed to mock build |
||||
default: "-p snyk-only-unstable --tarball-build-script=:" |
||||
|
||||
- name: archive-name |
||||
type: string |
||||
description: The name of the git archive file |
||||
default: $(context.taskRun.uid).tar.gz |
||||
|
||||
- name: tarball-storage-dir |
||||
type: string |
||||
description: What directory the scan tar gz will be put into |
||||
default: /workspace/source-tars/$(context.taskRun.name) |
||||
|
||||
- name: working-dir |
||||
type: string |
||||
description: Working directory for the task |
||||
default: /home/covscan |
||||
|
||||
workspaces: |
||||
- name: source-tars |
||||
description: This workspace contains our source tar gzips for covscan and is semi-persistant |
||||
- name: ssl-ca-directory |
||||
description: Location of CA bundle for ssl verification with internal services |
||||
|
||||
|
||||
volumes: |
||||
- name: osh-client-kerb-vol |
||||
secret: |
||||
defaultMode: 384 |
||||
optional: false |
||||
secretName: kerberos-keytab-osh |
||||
|
||||
- name: osh-client-kerb-config-vol |
||||
configMap: |
||||
name: kerberos-config-osh-client |
||||
items: |
||||
- key: linux-krb5.conf |
||||
path: linux-krb5.conf |
||||
defaultMode: 384 |
||||
optional: false |
||||
|
||||
- name: osh-client-config-vol |
||||
configMap: |
||||
name: osh-client-config |
||||
items: |
||||
- key: client.conf |
||||
path: client.conf |
||||
optional: false |
||||
|
||||
steps: |
||||
- name: perform-osh-scm-scan |
||||
image: quay.io/pct-security/osh-wrapper-client:latest |
||||
workingDir: $(params.working-dir) |
||||
|
||||
volumeMounts: |
||||
- name: osh-client-kerb-vol |
||||
mountPath: /kerberos |
||||
readOnly: true |
||||
|
||||
- name: osh-client-config-vol |
||||
mountPath: /etc/osh/client.conf |
||||
readOnly: true |
||||
subPath: client.conf |
||||
|
||||
- name: osh-client-kerb-config-vol |
||||
mountPath: /etc/krb5.conf |
||||
readOnly: true |
||||
subPath: linux-krb5.conf |
||||
|
||||
script: | |
||||
#!/bin/bash |
||||
echo $(params.working-dir) |
||||
echo $(params.repo-url) |
||||
echo $(params.revision) |
||||
echo $(params.mock-build-params) |
||||
echo $(params.archive-name) |
||||
git clone -v $(params.repo-url) -b $(params.revision) |
||||
git --git-dir=$(basename $(params.repo-url) .git)/.git archive --format=tar.gz HEAD -o $(params.working-dir)/$(params.archive-name) |
||||
mkdir $(params.tarball-storage-dir) |
||||
cp $(params.working-dir)/$(params.archive-name) $(params.tarball-storage-dir)/ |
||||
|
||||
covscan mock-build $(params.mock-build-params) $(params.working-dir)/$(params.archive-name) |
||||
Loading…
Reference in new issue