apiVersion: tekton.dev/v1alpha1 kind: PipelineResource metadata: name: github-mosquitto-prometheus-exporter spec: type: git params: - name: revision value: master - name: url value: https://github.com/sapcc/mosquitto-exporter.git --- apiVersion: tekton.dev/v1alpha1 kind: PipelineResource metadata: name: img-mosquitto-prometheus-exporter spec: type: image params: - name: url value: cr.lan/mosquitto-prometheus-exporter --- apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: build-mosquitto-prometheus-exporter spec: params: - name: pathToDockerFile type: string default: $(resources.inputs.source.path)/Dockerfile - name: pathToContext type: string default: $(resources.inputs.source.path) resources: inputs: - name: source type: git outputs: - name: builtImage type: image steps: - name: build-binary image: cr.lan/debian-golang-stable script: | #!/usr/bin/env bash cd $(resources.inputs.source.path) ls -al export GOARCH=arm64 export GOPATH=/usr/src/gopath export GOCACHE=/usr/src/gocache go env go get github.com/sapcc/mosquitto-exporter make -j4 build CGO_ENABLED=0 - name: build-and-push image: gcr.io/kaniko-project/executor:arm64 command: - /kaniko/executor args: - --dockerfile=$(params.pathToDockerFile) - --destination=$(resources.outputs.builtImage.url) - --context=$(params.pathToContext) - --snapshotMode=redo - --skip-tls-verify workspaces: - name: usr-src mountPath: /usr/src --- apiVersion: tekton.dev/v1beta1 kind: TaskRun metadata: name: img-mosquitto-prometheus-exporter spec: taskRef: name: build-mosquitto-prometheus-exporter params: - name: pathToDockerFile value: Dockerfile resources: inputs: - name: source resourceRef: name: github-mosquitto-prometheus-exporter outputs: - name: builtImage resourceRef: name: img-mosquitto-prometheus-exporter workspaces: - name: usr-src persistentVolumeClaim: claimName: tektoncd-workspaces subPath: usr_src