Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push snapshot ECK release on successful PR build #1184

Merged
merged 9 commits into from
Jul 9, 2019
3 changes: 2 additions & 1 deletion build/ci/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ ci-release: vault-public-key vault-docker-creds
-e "REPOSITORY=$(REPOSITORY)" \
-e "ELASTIC_DOCKER_LOGIN=$(DOCKER_LOGIN)" \
-e "ELASTIC_DOCKER_PASSWORD=$(shell cat $(DOCKER_CREDENTIALS_FILE))" \
-e "RELEASE=true" \
-e "USE_ELASTIC_DOCKER_REGISTRY=true" \
-e "SNAPSHOT_RELEASE=$(SNAPSHOT_RELEASE)" \
cloud-on-k8s-ci-release \
bash -c "make -C operators ci-release"

Expand Down
11 changes: 11 additions & 0 deletions build/ci/pr/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ pipeline {
}

post {
success {
withEnv([
'REGISTRY=push.docker.elastic.co',
'REPOSITORY=eck-snapshots',
'IMG_SUFFIX=',
'SNAPSHOT_RELEASE=true',
'TAG_NAME=${ghprbPullId}'
]) {
sh 'make -C build/ci ci-release'
}
}
cleanup {
sh 'make -C build/ci ci-gke-cleanup'
cleanWs()
Expand Down
1 change: 1 addition & 0 deletions build/ci/release/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pipeline {
IMG_NAME = 'eck-operator'
IMG_SUFFIX = ''
LATEST_RELEASED_IMG = "docker.elastic.co/${REPOSITORY}/${IMG_NAME}:${TAG_NAME}"
SNAPSHOT_RELEASE = 'false'
}

options {
Expand Down
10 changes: 7 additions & 3 deletions operators/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ endif
IMG_SUFFIX ?= -$(subst _,,$(USER))
IMG ?= $(REGISTRY)/$(REPOSITORY)/$(NAME)$(IMG_SUFFIX)
TAG ?= $(shell git rev-parse --short --verify HEAD)
OPERATOR_IMAGE ?= $(IMG):$(TAG)
OPERATOR_IMAGE ?= $(IMG):$(VERSION)-$(TAG)
ifeq ($(SNAPSHOT_RELEASE), false)
thbkrkr marked this conversation as resolved.
Show resolved Hide resolved
OPERATOR_IMAGE = $(IMG):$(TAG)
endif
thbkrkr marked this conversation as resolved.
Show resolved Hide resolved
OPERATOR_IMAGE_LATEST ?= $(IMG):latest

GO_LDFLAGS := -X github.com/elastic/cloud-on-k8s/operators/pkg/about.version=$(VERSION) \
Expand Down Expand Up @@ -269,7 +272,7 @@ docker-build:
-t $(OPERATOR_IMAGE)

docker-push:
ifeq ($(RELEASE), true)
ifeq ($(USE_ELASTIC_DOCKER_REGISTRY), true)
@ docker login -u $(ELASTIC_DOCKER_LOGIN) -p $(ELASTIC_DOCKER_PASSWORD) push.docker.elastic.co
endif
ifeq ($(KUBECTL_CLUSTER), minikube)
Expand Down Expand Up @@ -346,9 +349,10 @@ ci-bootstrap-gke:

ci-release: export GO_TAGS = release
ci-release: export LICENSE_PUBKEY = $(ROOT_DIR)/build/ci/license.key
ci-release: export LATEST_RELEASED_IMG = docker.elastic.co/eck/eck-operator:$(TAG)
ci-release: export LATEST_RELEASED_IMG = docker.elastic.co/$(REPOSITORY)/eck-operator:$(TAG)
ci-release:
@ $(MAKE) dep-vendor-only generate docker-build docker-push
@ echo $(OPERATOR_IMAGE) was pushed!


##########################
Expand Down