Merge "Fix for Templater latest image"

This commit is contained in:
Zuul 2021-04-29 15:22:52 +00:00 committed by Gerrit Code Review
commit c55258f6cb
16 changed files with 70 additions and 49 deletions

View File

@ -170,13 +170,10 @@ ifeq ($(PUBLISH), true)
@docker push $(DOCKER_IMAGE)
endif
# Use specific Dockerfile instead of general one to make image for kubeval-validator and toolbox
docker-image-toolbox: DOCKER_CMD_FLAGS+=-f krm-functions/toolbox/Dockerfile
docker-image-kubeval-validator: DOCKER_CMD_FLAGS+=-f krm-functions/kubeval-validator/image/Dockerfile
.PHONY: $(PLUGINS_IMAGE_TGT)
$(PLUGINS_IMAGE_TGT):
$(eval plugin_name=$(subst docker-image-,,$@))
@docker build . $(DOCKER_CMD_FLAGS) \
@docker build $(PLUGINS_DIR)/$(plugin_name) $(DOCKER_CMD_FLAGS) \
--label $(LABEL) \
--label "org.opencontainers.image.revision=$(COMMIT)" \
--label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \

View File

@ -1,4 +1,6 @@
FROM gcr.io/gcp-runtimes/go1-builder:1.15 as builder
ARG GO_IMAGE=gcr.io/gcp-runtimes/go1-builder:1.15
ARG PLUGINS_RELEASE_IMAGE=alpine:3.12.0
FROM ${GO_IMAGE} as builder
# Inject custom root certificate authorities if needed
# Docker does not have a good conditional copy statement and requires that a source file exists
@ -14,6 +16,6 @@ RUN /usr/local/go/bin/go mod download
COPY main.go .
RUN /usr/local/go/bin/go build -v -o /usr/local/bin/config-function ./
FROM alpine:latest
FROM ${PLUGINS_RELEASE_IMAGE} as release
COPY --from=builder /usr/local/bin/config-function /usr/local/bin/config-function
CMD ["/usr/local/bin/config-function"]

View File

@ -19,45 +19,44 @@ USE_PROXY ?= false
.PHONY: build
build:
(cd image && go build -v -o $(GOBIN)/config-function .)
(go build -v -o $(GOBIN)/config-function .)
.PHONY: all
all: generate license build fix vet fmt test lint tidy
.PHONY: fix
fix:
(cd image && go fix ./...)
(go fix .)
.PHONY: fmt
fmt:
(cd image && go fmt ./...)
(go fmt .)
.PHONY: generate
generate:
(which $(GOBIN)/mdtogo || go get sigs.k8s.io/kustomize/cmd/mdtogo)
(cd image && GOBIN=$(GOBIN) go generate ./...)
(GOBIN=$(GOBIN) go generate .)
.PHONY: tidy
tidy:
(cd image && go mod tidy)
(go mod tidy)
.PHONY: fix
lint:
(which $(GOBIN)/golangci-lint || go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.19.1)
(cd image && $(GOBIN)/golangci-lint run ./...)
($(GOBIN)/golangci-lint run .)
.PHONY: test
test:
(cd image && go test -cover ./...)
(go test -cover .)
.PHONY: vet
vet:
(cd image && go vet ./...)
(go vet .)
.PHONY: image
image:
ifeq ($(USE_PROXY), true)
cd image && \
docker build . --network=host \
--build-arg http_proxy=$(PROXY) \
--build-arg https_proxy=$(PROXY) \
@ -68,7 +67,6 @@ ifeq ($(USE_PROXY), true)
--tag $(DOCKER_IMAGE) \
--force-rm=$(DOCKER_FORCE_CLEAN)
else
cd image && \
docker build . --network=host \
--tag $(DOCKER_IMAGE) \
--force-rm=$(DOCKER_FORCE_CLEAN)

View File

@ -0,0 +1,6 @@
# Additional Docker image root certificate authorities
If you require additional certificate authorities for your Docker image:
* Add ASCII PEM encoded .crt files to this directory
* The files will be copied into your docker image at build time.
To update manually copy the .crt files to /usr/local/share/ca-certificates/ and run sudo update-ca-certificates.

View File

@ -3,7 +3,7 @@ module opendev.org/airship/airshipctl/functions/cloud-init/image
go 1.14
require (
opendev.org/airship/airshipctl v0.0.0-20210217205206-b8a4b6ad734c
opendev.org/airship/airshipctl v0.0.0-20210421143147-014e24cd1591
sigs.k8s.io/kustomize/kyaml v0.10.0
sigs.k8s.io/kustomize/api v0.7.2
)

View File

@ -4,10 +4,10 @@ FROM ${GO_IMAGE} as function
ENV PATH "/usr/local/go/bin:$PATH"
ENV CGO_ENABLED=0
WORKDIR /go/src/
COPY krm-functions/kubeval-validator/image/go.mod .
COPY krm-functions/kubeval-validator/image/go.sum .
COPY image/go.mod .
COPY image/go.sum .
RUN go mod download
COPY krm-functions/kubeval-validator/image/main.go .
COPY image/main.go .
RUN go build -v -o /usr/local/bin/config-function ./
FROM ${PLUGINS_RELEASE_IMAGE} as release
@ -24,5 +24,5 @@ RUN echo "**** install Python ****" && \
RUN pip3 install 'ruamel.yaml==0.16.13' 'openapi2jsonschema==0.9.0' openapi-spec-validator
COPY --from=function /usr/local/bin/config-function /usr/local/bin/config-function
COPY krm-functions/kubeval-validator/image/extract-openapi.py /usr/local/bin/
COPY image/extract-openapi.py /usr/local/bin/
CMD ["config-function"]

View File

@ -1,4 +1,6 @@
FROM gcr.io/gcp-runtimes/go1-builder:1.15 as builder
ARG GO_IMAGE=gcr.io/gcp-runtimes/go1-builder:1.15
ARG PLUGINS_RELEASE_IMAGE=alpine:3.12.0
FROM ${GO_IMAGE} as builder
# Inject custom root certificate authorities if needed
# Docker does not have a good conditional copy statement and requires that a source file exists
@ -14,6 +16,6 @@ RUN /usr/local/go/bin/go mod download
COPY main.go .
RUN /usr/local/go/bin/go build -v -o /usr/local/bin/config-function ./
FROM alpine:latest
FROM ${PLUGINS_RELEASE_IMAGE} as release
COPY --from=builder /usr/local/bin/config-function /usr/local/bin/config-function
CMD ["/usr/local/bin/config-function"]

View File

@ -19,45 +19,44 @@ USE_PROXY ?= false
.PHONY: build
build:
(cd image && go build -v -o $(GOBIN)/config-function .)
(go build -v -o $(GOBIN)/config-function .)
.PHONY: all
all: generate license build fix vet fmt test lint tidy
.PHONY: fix
fix:
(cd image && go fix ./...)
(go fix .)
.PHONY: fmt
fmt:
(cd image && go fmt ./...)
(go fmt .)
.PHONY: generate
generate:
(which $(GOBIN)/mdtogo || go get sigs.k8s.io/kustomize/cmd/mdtogo)
(cd image && GOBIN=$(GOBIN) go generate ./...)
(GOBIN=$(GOBIN) go generate .)
.PHONY: tidy
tidy:
(cd image && go mod tidy)
(go mod tidy)
.PHONY: fix
lint:
(which $(GOBIN)/golangci-lint || go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.19.1)
(cd image && $(GOBIN)/golangci-lint run ./...)
($(GOBIN)/golangci-lint run .)
.PHONY: test
test:
(cd image && go test -cover ./...)
(go test -cover .)
.PHONY: vet
vet:
(cd image && go vet ./...)
(go vet .)
.PHONY: image
image:
ifeq ($(USE_PROXY), true)
cd image && \
docker build . --network=host \
--build-arg http_proxy=$(PROXY) \
--build-arg https_proxy=$(PROXY) \
@ -68,7 +67,6 @@ ifeq ($(USE_PROXY), true)
--tag $(DOCKER_IMAGE) \
--force-rm=$(DOCKER_FORCE_CLEAN)
else
cd image && \
docker build . --network=host \
--tag $(DOCKER_IMAGE) \
--force-rm=$(DOCKER_FORCE_CLEAN)

View File

@ -0,0 +1,6 @@
# Additional Docker image root certificate authorities
If you require additional certificate authorities for your Docker image:
* Add ASCII PEM encoded .crt files to this directory
* The files will be copied into your docker image at build time.
To update manually copy the .crt files to /usr/local/share/ca-certificates/ and run sudo update-ca-certificates.

View File

@ -3,6 +3,6 @@ module opendev.org/airship/airshipctl/functions/replacement-transformer/image
go 1.14
require (
opendev.org/airship/airshipctl v0.0.0-20201007215749-76e4d3f48c5a
opendev.org/airship/airshipctl v0.0.0-20210421143147-014e24cd1591
sigs.k8s.io/kustomize/kyaml v0.7.1
)

View File

@ -1,4 +1,6 @@
FROM gcr.io/gcp-runtimes/go1-builder:1.15 as builder
ARG GO_IMAGE=gcr.io/gcp-runtimes/go1-builder:1.15
ARG PLUGINS_RELEASE_IMAGE=alpine:3.12.0
FROM ${GO_IMAGE} as builder
# Inject custom root certificate authorities if needed
# Docker does not have a good conditional copy statement and requires that a source file exists
@ -14,6 +16,6 @@ RUN /usr/local/go/bin/go mod download
COPY main.go .
RUN /usr/local/go/bin/go build -v -o /usr/local/bin/config-function ./
FROM alpine:latest
FROM ${PLUGINS_RELEASE_IMAGE} as release
COPY --from=builder /usr/local/bin/config-function /usr/local/bin/config-function
CMD ["/usr/local/bin/config-function"]

View File

@ -19,45 +19,44 @@ USE_PROXY ?= false
.PHONY: build
build:
(cd image && go build -v -o $(GOBIN)/config-function .)
(go build -v -o $(GOBIN)/config-function .)
.PHONY: all
all: generate license build fix vet fmt test lint tidy
.PHONY: fix
fix:
(cd image && go fix ./...)
(go fix .)
.PHONY: fmt
fmt:
(cd image && go fmt ./...)
(go fmt .)
.PHONY: generate
generate:
(which $(GOBIN)/mdtogo || go get sigs.k8s.io/kustomize/cmd/mdtogo)
(cd image && GOBIN=$(GOBIN) go generate ./...)
(GOBIN=$(GOBIN) go generate .)
.PHONY: tidy
tidy:
(cd image && go mod tidy)
(go mod tidy)
.PHONY: fix
lint:
(which $(GOBIN)/golangci-lint || go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.19.1)
(cd image && $(GOBIN)/golangci-lint run ./...)
($(GOBIN)/golangci-lint run .)
.PHONY: test
test:
(cd image && go test -cover ./...)
(go test -cover .)
.PHONY: vet
vet:
(cd image && go vet ./...)
(go vet .)
.PHONY: image
image:
ifeq ($(USE_PROXY), true)
cd image && \
docker build . --network=host \
--build-arg http_proxy=$(PROXY) \
--build-arg https_proxy=$(PROXY) \
@ -68,7 +67,6 @@ ifeq ($(USE_PROXY), true)
--tag $(DOCKER_IMAGE) \
--force-rm=$(DOCKER_FORCE_CLEAN)
else
cd image && \
docker build . --network=host \
--tag $(DOCKER_IMAGE) \
--force-rm=$(DOCKER_FORCE_CLEAN)

View File

@ -0,0 +1,6 @@
# Additional Docker image root certificate authorities
If you require additional certificate authorities for your Docker image:
* Add ASCII PEM encoded .crt files to this directory
* The files will be copied into your docker image at build time.
To update manually copy the .crt files to /usr/local/share/ca-certificates/ and run sudo update-ca-certificates.

View File

@ -3,6 +3,6 @@ module opendev.org/airship/airshipctl/functions/templater/image
go 1.14
require (
opendev.org/airship/airshipctl v0.0.0-20201007215749-76e4d3f48c5a
opendev.org/airship/airshipctl v0.0.0-20210421143147-014e24cd1591
sigs.k8s.io/kustomize/kyaml v0.7.1
)

View File

@ -20,9 +20,9 @@ RUN chmod +x /kubectl /calicoctl
FROM ${GO_IMAGE} as builder
ENV CGO_ENABLED=0
WORKDIR /go/src/
COPY krm-functions/toolbox/image/go.mod .
COPY image/go.mod .
RUN /usr/local/go/bin/go mod download
COPY krm-functions/toolbox/main.go .
COPY main.go .
RUN /usr/local/go/bin/go build -v -o /usr/local/bin/config-function ./
FROM ${PLUGINS_RELEASE_IMAGE} as release

View File

@ -0,0 +1,6 @@
# Additional Docker image root certificate authorities
If you require additional certificate authorities for your Docker image:
* Add ASCII PEM encoded .crt files to this directory
* The files will be copied into your docker image at build time.
To update manually copy the .crt files to /usr/local/share/ca-certificates/ and run sudo update-ca-certificates.