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

chore(#199): migrate from devshift registry to quay.io #218

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
20 changes: 10 additions & 10 deletions .make/Makefile.deploy.prow
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ oc-deploy-hook: build-hook deploy-hook ## Deploys hook service only
@echo "Deploys hook service ${TAG}"
@oc process -f $(CLUSTER_DIR)/hook-template.yaml \
-p REGISTRY=$(REGISTRY) \
-p DOCKER_REPO=$(DOCKER_REPO) \
-p IMG_REPO=$(IMG_REPO) \
-p IMAGE_TAG=$(TAG) \
-o yaml | oc apply -f -

Expand All @@ -21,16 +21,16 @@ build-hook: update

.PHONY: build-hook-image
build-hook-image:
$(DOCKER) build --build-arg BINARY=hook -t $(REGISTRY)/$(DOCKER_REPO)/hook -f $(DEPLOY_DOCKERFILE) .
$(DOCKER) tag $(REGISTRY)/$(DOCKER_REPO)/hook $(REGISTRY)/$(DOCKER_REPO)/hook:$(TAG)
$(DOCKER) build --build-arg BINARY=hook -t $(REGISTRY)/$(IMG_REPO)-hook -f $(DEPLOY_DOCKERFILE) .
$(DOCKER) tag $(REGISTRY)/$(IMG_REPO)-hook $(REGISTRY)/$(IMG_REPO)-hook:$(TAG)

.PHONY: push-hook-image
push-hook-image: build-hook-image
$(DOCKER) push $(REGISTRY)/$(DOCKER_REPO)/hook
$(DOCKER) push $(REGISTRY)/$(IMG_REPO)-hook

.PHONY: clean-hook-image
clean-hook-image:
$(DOCKER) rmi -f $(REGISTRY)/$(DOCKER_REPO)/hook
$(DOCKER) rmi -f $(REGISTRY)/$(IMG_REPO)-hook

.PHONY: oc-deploy-plugins ## Builds plugin images, updates configuration and deploys new version of ike-plugins
oc-deploy-plugins: oc-init-project compile deploy-plugins oc-generate-deployments
Expand All @@ -41,7 +41,7 @@ $(OC_DEPLOYMENTS): oc-%: %
@mkdir -p $(PLUGIN_DEPLOYMENTS_DIR)
@oc process -f $(CLUSTER_DIR)/ike-prow-template.yaml \
-p REGISTRY=$(REGISTRY) \
-p DOCKER_REPO=$(DOCKER_REPO) \
-p IMG_REPO=$(IMG_REPO) \
-p PLUGIN_NAME=$< \
-p IMAGE_TAG=$(TAG) \
-o yaml > $(PLUGIN_DEPLOYMENTS_DIR)/$<.yaml
Expand All @@ -54,16 +54,16 @@ deploy-plugins: build-plugin-images push-plugin-images
.PHONY: build-plugin-images $(PLUGINS)
build-plugin-images: $(BUILD_IMAGES)
$(BUILD_IMAGES): build-%: %
$(DOCKER) build --build-arg BINARY=$< -t $(REGISTRY)/$(DOCKER_REPO)/$< -f $(DEPLOY_DOCKERFILE) .
$(DOCKER) tag $(REGISTRY)/$(DOCKER_REPO)/$< $(REGISTRY)/$(DOCKER_REPO)/$<:$(TAG)
$(DOCKER) build --build-arg BINARY=$< -t $(REGISTRY)/$(IMG_REPO)-$< -f $(DEPLOY_DOCKERFILE) .
$(DOCKER) tag $(REGISTRY)/$(IMG_REPO)-$< $(REGISTRY)/$(IMG_REPO)-$<:$(TAG)


.PHONY: clean-plugin-images
clean-plugin-images: $(CLEAN_IMAGES)
$(CLEAN_IMAGES): clean-%: %
$(DOCKER) rmi -f $(REGISTRY)/$(DOCKER_REPO)/$<
$(DOCKER) rmi -f $(REGISTRY)/$(IMG_REPO)-$<

.PHONY: push-plugin-images
push-plugin-images: build-plugin-images $(PUSH_IMAGES)
$(PUSH_IMAGES): push-%: %
$(DOCKER) push $(REGISTRY)/$(DOCKER_REPO)/$<
$(DOCKER) push $(REGISTRY)/$(IMG_REPO)-$<
2 changes: 1 addition & 1 deletion Dockerfile.deploy.rhel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM prod.registry.devshift.net/osio-prod/base/pcp-tools:latest
FROM quay.io/openshiftio/rhel-base-pcp-tools:latest

LABEL maintainer="Devtools <[email protected]>"
LABEL maintainer="Devtools-test <[email protected]>"
Expand Down
28 changes: 14 additions & 14 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ BINARY_DIR:=${PWD}/bin
CLUSTER_DIR?=${PWD}/cluster
PLUGIN_DEPLOYMENTS_DIR?=$(CLUSTER_DIR)/generated

REGISTRY?=docker.io
DOCKER_REPO?=ike-prow-plugins
REGISTRY?=quay.io
IMG_REPO?=openshiftio/ike-prow-plugins
BUILD_IMAGES:=$(patsubst %,build-%, $(PLUGINS))
PUSH_IMAGES:=$(patsubst %,push-%, $(PLUGINS))
CLEAN_IMAGES:=$(patsubst %,clean-%, $(PLUGINS))
Expand Down
27 changes: 17 additions & 10 deletions cico_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@ set -e
# Source environment variables of the jenkins slave
# that might interest this worker.
function load_jenkins_vars() {
if [ -e "jenkins-env" ]; then
cat jenkins-env \
| grep -E "(DEVSHIFT_TAG_LEN|DEVSHIFT_USERNAME|DEVSHIFT_PASSWORD|JENKINS_URL|GIT_BRANCH|GIT_COMMIT|BUILD_NUMBER|ghprbSourceBranch|ghprbActualCommit|BUILD_URL|ghprbPullId)=" \
| sed 's/^/export /g' \
> ~/.jenkins-env
source ~/.jenkins-env
if [ -e "jenkins-env.json" ]; then
eval "$(./env-toolkit load -f jenkins-env.json \
DEVSHIFT_TAG_LEN \
QUAY_USERNAME \
QUAY_PASSWORD \
JENKINS_URL \
GIT_BRANCH \
GIT_COMMIT \
BUILD_NUMBER \
ghprbSourceBranch \
ghprbActualCommit \
BUILD_URL \
ghprbPullId)"
fi
}

Expand Down Expand Up @@ -49,17 +56,17 @@ function cleanup_env {
}

function deploy() {
export REGISTRY="push.registry.devshift.net"
export REGISTRY="quay.io"
export PLUGINS='work-in-progress test-keeper pr-sanitizer'

if [ "${TARGET}" = "rhel" ]; then
export DEPLOY_DOCKERFILE='Dockerfile.deploy.rhel'
export DOCKER_REPO="osio-prod/ike-prow-plugins"
export IMG_REPO="openshiftio/rhel-ike-prow-plugins"
fi

# Login first
if [ -n "${DEVSHIFT_USERNAME}" -a -n "${DEVSHIFT_PASSWORD}" ]; then
docker login -u ${DEVSHIFT_USERNAME} -p ${DEVSHIFT_PASSWORD} ${REGISTRY}
if [ -n "${QUAY_USERNAME}" -a -n "${QUAY_PASSWORD}" ]; then
docker login -u ${QUAY_USERNAME} -p ${QUAY_PASSWORD} ${REGISTRY}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest using IMG_REPO prefix instead of QUAY. This will then have a proper meaning for any repo we use.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea for IMG_REPO but it's difficult for QUAY_USERNAME and QUAY_PASSWORD. Note that this come directly from credentials in CICO, so if we want to rename them, we should do it in these scripts.

else
echo "Could not login, missing credentials for the registry"
fi
Expand Down
8 changes: 4 additions & 4 deletions cluster/hook-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ apiVersion: v1
parameters:
- name: REGISTRY
required: true
value: docker.io
- name: DOCKER_REPO
value: quay.io
- name: IMG_REPO
required: true
value: arquillian
value: openshiftio/ike-prow-plugins
- name: IMAGE_TAG
required: true
value: latest
Expand Down Expand Up @@ -42,7 +42,7 @@ objects:
terminationGracePeriodSeconds: 180
containers:
- name: hook
image: ${REGISTRY}/${DOCKER_REPO}/hook:${IMAGE_TAG}
image: ${REGISTRY}/${IMG_REPO}-hook:${IMAGE_TAG}
imagePullPolicy: Always
resources:
requests:
Expand Down
8 changes: 4 additions & 4 deletions cluster/ike-prow-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ apiVersion: v1
parameters:
- name: REGISTRY
required: true
value: docker.io
- name: DOCKER_REPO
value: quay.io
- name: IMG_REPO
required: true
value: arquillian
value: openshiftio/ike-prow-plugins
- name: PLUGIN_NAME
required: true
- name: IMAGE_TAG
Expand Down Expand Up @@ -42,7 +42,7 @@ objects:
terminationGracePeriodSeconds: 180
containers:
- name: ${PLUGIN_NAME}
image: ${REGISTRY}/${DOCKER_REPO}/${PLUGIN_NAME}:${IMAGE_TAG}
image: ${REGISTRY}/${IMG_REPO}-${PLUGIN_NAME}:${IMAGE_TAG}
imagePullPolicy: Always
resources:
requests:
Expand Down
2 changes: 1 addition & 1 deletion local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
eval $(minishift docker-env)
docker login -u $(oc whoami) -p $(oc whoami -t) $(minishift openshift registry)
export REGISTRY=$(minishift openshift registry)
export DOCKER_REPO=$(oc project -q)
export IMG_REPO=$(oc project -q)/$(oc project -q)
# end::local_docker_registry[]

# tag::seeding_secrets[]
Expand Down