Browse Source

jenkins versioning

tags/0.0.3.1
Vladimir Smagin 5 months ago
parent
commit
de9889b6b0
6 changed files with 20 additions and 45 deletions
  1. +3
    -3
      Dockerfile
  2. +13
    -18
      Jenkinsfile
  3. +0
    -21
      Makefile
  4. +1
    -1
      VERSION
  5. +2
    -1
      deploy/operator.yaml
  6. +1
    -1
      version/version.go

+ 3
- 3
Dockerfile View File

@@ -3,16 +3,16 @@ FROM golang:1.13-alpine
RUN apk update
RUN apk add git mercurial

WORKDIR /app/mqtt-operator
WORKDIR /app/operator
COPY . .

WORKDIR /app/mqtt-operator/cmd/manager
WORKDIR /app/operator/cmd/manager

RUN CGO_ENABLED=0 go build
RUN go install

FROM alpine:3.11

COPY --from=0 /go/bin/manager /usr/local/bin/mqtt-operator
COPY --from=0 /go/bin/manager /usr/local/bin/operator

ENTRYPOINT ["/usr/local/bin/entrypoint"]

+ 13
- 18
Jenkinsfile View File

@@ -11,7 +11,7 @@ node {
def commit_hash = checkout(scm).GIT_COMMIT
def version

stage("Prepare version control") {
stage("Prepare version") {
try {
version = readFile file: "VERSION"
echo "Detected version: ${version}"
@@ -29,23 +29,18 @@ node {
}
}

// stage("Push Image") {
// try {

// docker.withRegistry("https://${registry}", "dockerhub") {
// image.push()
// }
stage("Push Image") {
try {

// if (branch == "master") {
// docker.withRegistry("https://${registry}", "dockerhub") {
// image.push("latest")
// }
// }
docker.withRegistry("https://${registry}", "dockerhub") {
image.push("${version}")
}

// } catch(Exception e) {
// error("Failed to push image")
// } finally {
// sh "docker rmi ${image_name} || true"
// }
// }
} catch(Exception e) {
error("Failed to push image")
} finally {
// cleanup
sh "docker rmi ${image_name} || true"
}
}
}

+ 0
- 21
Makefile View File

@@ -1,21 +0,0 @@
OPERATOR_IMAGE_NAME := mqtt-operator
VERSION=$(shell cat ./VERSION)
COMMIT=$(shell git rev-parse --short HEAD)
.PHONY: all clean build push

all: gen build

gen:
operator-sdk generate k8s

build:
operator-sdk build $(OPERATOR_IMAGE_NAME):$(VERSION)

push:
docker tag $(OPERATOR_IMAGE_NAME):$(VERSION) iam21h/mqtt-operator:$(VERSION)
docker tag $(OPERATOR_IMAGE_NAME):$(VERSION) iam21h/mqtt-operator:latest
docker push iam21h/mqtt-operator:$(VERSION)
docker push iam21h/mqtt-operator:latest

clean:
rm -rf bin/*

+ 1
- 1
VERSION View File

@@ -1 +1 @@
0.0.3
0.0.3.1

+ 2
- 1
deploy/operator.yaml View File

@@ -15,7 +15,8 @@ spec:
serviceAccountName: mqtt-operator
containers:
- name: mqtt-operator
image: iam21h/mqtt-operator
# there no latest tag anymore, used last version number
image: iam21h/mqtt-operator:0.0.3.1
command:
- mqtt-operator
imagePullPolicy: Always


+ 1
- 1
version/version.go View File

@@ -1,5 +1,5 @@
package version

var (
Version = "0.0.3"
Version = "0.0.3.1"
)

Loading…
Cancel
Save