mosquitto in tekton
This commit is contained in:
87
apps/mosquitto/tekton-image-build-prometheus-exporter.yaml
Normal file
87
apps/mosquitto/tekton-image-build-prometheus-exporter.yaml
Normal file
@@ -0,0 +1,87 @@
|
||||
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: docker.io/golang
|
||||
script:
|
||||
#!/usr/bin/env bash
|
||||
PKG_NAME=github.com/sapcc/mosquitto-exporter
|
||||
BUILD_DIR=bin
|
||||
MOSQUITTO_EXPORTER_BINARY=${}BUILD_DIR}/mosquitto_exporter
|
||||
IMAGE=apcc/mosquitto-exporter
|
||||
VERSION=0.6.0
|
||||
LDFLAGS=-s -w -X main.Version=${VERSION} -X main.GITCOMMIT=`git rev-parse --short HEAD`
|
||||
CGO_ENABLED=0
|
||||
mkdir -p ${BUILD_DIR}
|
||||
go build -o ${MOSQUITTO_EXPORTER_BINARY} -ldflags="${LDFLAGS}" ${PKG_NAME}
|
||||
- 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)
|
||||
- --skip-tls-verify
|
||||
---
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: TaskRun
|
||||
metadata:
|
||||
name: img-mosquitto-prometheus-exporter-taskrun
|
||||
spec:
|
||||
#serviceAccountName: dockerhub-service
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user