golang image
This commit is contained in:
@@ -41,18 +41,22 @@ spec:
|
|||||||
type: image
|
type: image
|
||||||
steps:
|
steps:
|
||||||
- name: build-binary
|
- name: build-binary
|
||||||
image: debian:stable-slim
|
image: cr.lan/debian-golang-stable
|
||||||
script: |
|
script: |
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
cd $(resources.inputs.source.path)
|
||||||
pwd
|
pwd
|
||||||
|
ls -la
|
||||||
|
GO_PATH=/usr/src/gopath
|
||||||
PKG_NAME=github.com/sapcc/mosquitto-exporter
|
PKG_NAME=github.com/sapcc/mosquitto-exporter
|
||||||
BUILD_DIR=bin
|
BUILD_DIR=bin
|
||||||
MOSQUITTO_EXPORTER_BINARY=${BUILD_DIR}/mosquitto_exporter
|
MOSQUITTO_EXPORTER_BINARY=${BUILD_DIR}/mosquitto_exporter
|
||||||
IMAGE=apcc/mosquitto-exporter
|
IMAGE=apcc/mosquitto-exporter
|
||||||
VERSION=0.6.0
|
VERSION=0.6.0
|
||||||
LDFLAGS=-s -w -X main.Version=${VERSION} -X main.GITCOMMIT=`git rev-parse --short HEAD`
|
LDFLAGS="-s -w -X main.Version=${VERSION} -X main.GITCOMMIT=$(git rev-parse --short HEAD)"
|
||||||
CGO_ENABLED=0
|
CGO_ENABLED=0
|
||||||
mkdir -p ${BUILD_DIR}
|
GOOS=linux
|
||||||
|
mkdir -p ${BUILD_DIR} ${GO_PATH}
|
||||||
go build -o ${MOSQUITTO_EXPORTER_BINARY} -ldflags="${LDFLAGS}" ${PKG_NAME}
|
go build -o ${MOSQUITTO_EXPORTER_BINARY} -ldflags="${LDFLAGS}" ${PKG_NAME}
|
||||||
- name: build-and-push
|
- name: build-and-push
|
||||||
image: gcr.io/kaniko-project/executor:arm64
|
image: gcr.io/kaniko-project/executor:arm64
|
||||||
@@ -63,13 +67,15 @@ spec:
|
|||||||
- --destination=$(resources.outputs.builtImage.url)
|
- --destination=$(resources.outputs.builtImage.url)
|
||||||
- --context=$(params.pathToContext)
|
- --context=$(params.pathToContext)
|
||||||
- --skip-tls-verify
|
- --skip-tls-verify
|
||||||
|
workspaces:
|
||||||
|
- name: usr-src
|
||||||
|
mountPath: /usr/src
|
||||||
---
|
---
|
||||||
apiVersion: tekton.dev/v1beta1
|
apiVersion: tekton.dev/v1beta1
|
||||||
kind: TaskRun
|
kind: TaskRun
|
||||||
metadata:
|
metadata:
|
||||||
name: img-mosquitto-prometheus-exporter-taskrun
|
name: img-mosquitto-prometheus-exporter
|
||||||
spec:
|
spec:
|
||||||
#serviceAccountName: dockerhub-service
|
|
||||||
taskRef:
|
taskRef:
|
||||||
name: build-mosquitto-prometheus-exporter
|
name: build-mosquitto-prometheus-exporter
|
||||||
params:
|
params:
|
||||||
@@ -84,5 +90,9 @@ spec:
|
|||||||
- name: builtImage
|
- name: builtImage
|
||||||
resourceRef:
|
resourceRef:
|
||||||
name: img-mosquitto-prometheus-exporter
|
name: img-mosquitto-prometheus-exporter
|
||||||
|
workspaces:
|
||||||
|
- name: usr-src
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: tektoncd-workspaces
|
||||||
|
subPath: usr_src
|
||||||
|
|
||||||
Reference in New Issue
Block a user