diff --git a/.dockerignore b/.dockerignore index 72a90168..4f7c7a82 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,7 +3,10 @@ README.md .idea skaffold.yaml reviewdog.yml -charts/ +chart/ deploy/ .github/ installer/ +bin/ +test-data/ +test-events/ diff --git a/Dockerfile b/Dockerfile index e0d52d67..8da58cdb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,7 @@ # This is based on Debian and sets the GOPATH to /go. # https://hub.docker.com/_/golang FROM golang:1.16.2-alpine as builder + RUN apk add --no-cache gcc libc-dev git ARG version=develop diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml index 6d208a3a..e89f27c5 100644 --- a/chart/templates/deployment.yaml +++ b/chart/templates/deployment.yaml @@ -12,10 +12,11 @@ spec: {{- include "job-executor-service.selectorLabels" . | nindent 6 }} template: metadata: - {{- with .Values.podAnnotations }} annotations: + rollme: {{ randAlphaNum 5 | quote }} # forces pod restart (e.g., when updating helm values) + {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} - {{- end }} + {{- end }} labels: {{- include "job-executor-service.labels" . | nindent 8 }} spec: diff --git a/chart/values.schema.json b/chart/values.schema.json index 212cad33..3f37d517 100644 --- a/chart/values.schema.json +++ b/chart/values.schema.json @@ -56,9 +56,7 @@ "properties": { "image": { "properties": { - "repository": { - "pattern": "^[a-z0-9-./]{2,127}$" - } + "repository": {} } } } diff --git a/initcontainer.Dockerfile b/initcontainer.Dockerfile index 68927976..3619af73 100644 --- a/initcontainer.Dockerfile +++ b/initcontainer.Dockerfile @@ -22,17 +22,14 @@ COPY go.mod go.sum ./ # Download dependencies RUN go mod download -ARG debugBuild - -# set buildflags for debug build -RUN if [ ! -z "$debugBuild" ]; then export BUILDFLAGS='-gcflags "all=-N -l"'; fi - # Copy local code to the container image. COPY . . +# `skaffold debug` sets SKAFFOLD_GO_GCFLAGS to disable compiler optimizations +ARG SKAFFOLD_GO_GCFLAGS # Build the command inside the container. # (You may fetch or manage dependencies here, either manually or with a tool like "godep".) -RUN GOOS=linux go build -ldflags '-linkmode=external' $BUILDFLAGS -v -o job-executor-service-initcontainer cmd/job-executor-service-initcontainer/main.go +RUN GOOS=linux go build -ldflags '-linkmode=external' -gcflags="${SKAFFOLD_GO_GCFLAGS}" -v -o job-executor-service-initcontainer cmd/job-executor-service-initcontainer/main.go # Use a Docker multi-stage build to create a lean production image. # https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds @@ -58,10 +55,5 @@ EXPOSE 8080 # required for external tools to detect this as a go binary ENV GOTRACEBACK=all -# KEEP THE FOLLOWING LINES COMMENTED OUT!!! (they will be included within the travis-ci build) -#build-uncomment ADD MANIFEST / -#build-uncomment COPY entrypoint.sh / -#build-uncomment ENTRYPOINT ["/entrypoint.sh"] - # Run the web service on container startup. CMD ["/job-executor-service-initcontainer"] diff --git a/skaffold.yaml b/skaffold.yaml index e00d0d69..e16efc12 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -4,15 +4,20 @@ build: local: useBuildkit: true artifacts: + # job executor service - image: keptncontrib/job-executor-service docker: dockerfile: Dockerfile + # init container for actual jobs (will be used for every job that is started) + - image: keptncontrib/job-executor-service-initcontainer + docker: + dockerfile: initcontainer.Dockerfile # Before executing this, install job-executor-service manually: # helm install -n keptn job-executor-service https://github.com/keptn-contrib/job-executor-service/releases/download/0.1.4/job-executor-service-0.1.4.tgz deploy: helm: flags: - upgrade: ["--reuse-values"] + upgrade: ["--reuse-values"] # keep configuration (e.g., Keptn API Token) releases: - name: job-executor-service # needs to be the same name as currently used (check via helm ls -n keptn) namespace: keptn # needs to be the same namespace as where the helm-chart is currently deployed @@ -20,6 +25,8 @@ deploy: # recreatePods: false # don't recreate all pods artifactOverrides: image: keptncontrib/job-executor-service + jobexecutorserviceinitcontainer: + image: keptncontrib/job-executor-service-initcontainer imageStrategy: helm: { } overrides: @@ -28,5 +35,5 @@ deploy: tag: 0.10.0 resources: limits: - memory: 512Mi + memory: 512Mi # increase memory limit such that debugging using delve works chartPath: chart