Skip to content

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

Open
hemanik wants to merge 10 commits into
arquillian:masterfrom
hemanik:migration-to-quay
Open

chore(#199): migrate from devshift registry to quay.io#218
hemanik wants to merge 10 commits into
arquillian:masterfrom
hemanik:migration-to-quay

Conversation

@centos-ci
Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@hemanik hemanik requested a review from bartoszmajsak July 2, 2018 08:51
@bartoszmajsak
Copy link
Copy Markdown
Member

[test]

Comment thread .make/Makefile.deploy.prow Outdated
$(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)/$(DOCKER_REPO)-hook -f $(DEPLOY_DOCKERFILE) .
$(DOCKER) tag $(REGISTRY)/$(DOCKER_REPO)-hook $(REGISTRY)/$(DOCKER_REPO)-hook:$(TAG)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is it - instead of / now?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we can also change DOCKER_REPO -> IMG_REPO?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Because it changed from prod.registry.devshift.net/osio-prod/ike-prow-plugins/test-keeper to quay.io/openshiftio/ike-prow-plugins-test-keeper as per the new repositories.

Here's the discussion - https://chat.openshift.io/developers/pl/tqzbcjx5f3nmdg7co9fn5kay5a

Copy link
Copy Markdown
Member

@bartoszmajsak bartoszmajsak Jul 2, 2018

Choose a reason for hiding this comment

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

Thanks for the link. In such a case I think we should improve the naming here, as $(REGISTRY)/$(DOCKER_REPO)-hook is not really correct.

In our case this should be:

quay.io/openshiftio/rhel-ike-prow-plugins-work-in-progress

so

  • REGISTRY = quay.io
  • IMG_REPO = openshiftio
  • ike-prow-plugins- is a prefix of the plugin image name in such case.

Comment thread cico_setup.sh
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
Copy Markdown
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
Copy Markdown
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.

Comment thread cluster/hook-template.yaml Outdated
containers:
- name: hook
image: ${REGISTRY}/${DOCKER_REPO}/hook:${IMAGE_TAG}
image: ${REGISTRY}/${DOCKER_REPO}-hook:${IMAGE_TAG}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this is correct now. What is the value here for the generated yaml file?

Comment thread .make/Makefile.deploy.prow Outdated
$(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)/$(DOCKER_REPO)-hook -f $(DEPLOY_DOCKERFILE) .
$(DOCKER) tag $(REGISTRY)/$(DOCKER_REPO)-hook $(REGISTRY)/$(DOCKER_REPO)-hook:$(TAG)
Copy link
Copy Markdown
Member

@bartoszmajsak bartoszmajsak Jul 2, 2018

Choose a reason for hiding this comment

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

Thanks for the link. In such a case I think we should improve the naming here, as $(REGISTRY)/$(DOCKER_REPO)-hook is not really correct.

In our case this should be:

quay.io/openshiftio/rhel-ike-prow-plugins-work-in-progress

so

  • REGISTRY = quay.io
  • IMG_REPO = openshiftio
  • ike-prow-plugins- is a prefix of the plugin image name in such case.

@hemanik
Copy link
Copy Markdown
Member Author

hemanik commented Jul 2, 2018

@jmelis can you please verify this PR mainly from the centos-ci publishing point of view?

Comment thread .make/Makefile.deploy.prow Outdated
$(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)/$(OC_PROJECT_NAME)-hook -f $(DEPLOY_DOCKERFILE) .
$(DOCKER) tag $(REGISTRY)/$(IMG_REPO)-hook $(REGISTRY)/$(IMG_REPO)/$(OC_PROJECT_NAME)-hook:$(TAG)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't $(REGISTRY)/$(IMG_REPO)-hook be $(REGISTRY)/$(IMG_REPO)/$(OC_PROJECT_NAME)-hook now?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think so too.

Comment thread cico_setup.sh Outdated
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)=" \
| grep -E "(IMG_REPO_TAG_LEN|IMG_REPO_USERNAME|IMG_REPO_PASSWORD|JENKINS_URL|GIT_BRANCH|GIT_COMMIT|BUILD_NUMBER|ghprbSourceBranch|ghprbActualCommit|BUILD_URL|ghprbPullId)=" \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't know from where DEVSHIFT_* is coming. Might be env variable of Centos-CI. Can you make sure we are doing the right thing here?

Copy link
Copy Markdown
Contributor

@jmelis jmelis Jul 2, 2018

Choose a reason for hiding this comment

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

That is correct, DEVSHIFT_USERNAME and DEVSHIFT_PASSWORD are coming from CentOS-CI, however if migrating to quay, we should be using QUAY_USERNAME and QUAY_PASSWORD instead. Can you gobally replace DEVSHIFT_USERNAME and DEVSHIFT_PASSWORD with their quay counterparts? also, please keep DEVSHIFT_TAG_LEN as is, that's a special variable that contains the expected length of git commit hash and can't be renamed.

Also, I recommend you to no longer use such a mechanism to load the env, but rather use this:

function load_jenkins_vars() {
  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
}

It's a much safer approach as it's resilient to env vars with spaces, newlines and special chars.

Copy link
Copy Markdown
Contributor

@jmelis jmelis left a comment

Choose a reason for hiding this comment

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

I have added a few comments but the most important one is that there are two kind of quay repos, the public ones, and the private ones.

We are going to be building both CentOS based and RHEL based containers, and it's important to ensure that RHEL based containers are not pushed to public repos.

If it's a CentOS container it should be pushed to: $(REGISTRY)/$(IMG_REPO)/$(OC_PROJECT_NAME)-$<, but if it's a rhel container, it should be pushed to $(REGISTRY)/$(IMG_REPO)/rhel-$(OC_PROJECT_NAME)-$< and I don't see this logic anywhere.

You need to check for the TARGET env variable and check if $TARGET = rhel or not.

Comment thread cico_setup.sh Outdated
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)=" \
| grep -E "(IMG_REPO_TAG_LEN|IMG_REPO_USERNAME|IMG_REPO_PASSWORD|JENKINS_URL|GIT_BRANCH|GIT_COMMIT|BUILD_NUMBER|ghprbSourceBranch|ghprbActualCommit|BUILD_URL|ghprbPullId)=" \
Copy link
Copy Markdown
Contributor

@jmelis jmelis Jul 2, 2018

Choose a reason for hiding this comment

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

That is correct, DEVSHIFT_USERNAME and DEVSHIFT_PASSWORD are coming from CentOS-CI, however if migrating to quay, we should be using QUAY_USERNAME and QUAY_PASSWORD instead. Can you gobally replace DEVSHIFT_USERNAME and DEVSHIFT_PASSWORD with their quay counterparts? also, please keep DEVSHIFT_TAG_LEN as is, that's a special variable that contains the expected length of git commit hash and can't be renamed.

Also, I recommend you to no longer use such a mechanism to load the env, but rather use this:

function load_jenkins_vars() {
  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
}

It's a much safer approach as it's resilient to env vars with spaces, newlines and special chars.

Comment thread cico_setup.sh Outdated
if [ -n "${DEVSHIFT_USERNAME}" -a -n "${DEVSHIFT_PASSWORD}" ]; then
docker login -u ${DEVSHIFT_USERNAME} -p ${DEVSHIFT_PASSWORD} ${REGISTRY}
if [ -n "${IMG_REPO_USERNAME}" -a -n "${IMG_REPO_PASSWORD}" ]; then
docker login -u ${IMG_REPO_USERNAME} -p ${IMG_REPO_PASSWORD} ${REGISTRY}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please replace with QUAY_...

Comment thread .make/Makefile.deploy.prow Outdated
$(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)/$(OC_PROJECT_NAME)-hook -f $(DEPLOY_DOCKERFILE) .
$(DOCKER) tag $(REGISTRY)/$(IMG_REPO)-hook $(REGISTRY)/$(IMG_REPO)/$(OC_PROJECT_NAME)-hook:$(TAG)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think so too.

@alien-ike alien-ike added size/L and removed size/M labels Jul 3, 2018
@hemanik hemanik force-pushed the migration-to-quay branch from 236a9a9 to d29bd18 Compare July 3, 2018 08:55
@hemanik
Copy link
Copy Markdown
Member Author

hemanik commented Jul 3, 2018

You need to check for the TARGET env variable and check if $TARGET = rhel or not.

Here, we check if the $TARGET=rhel and the value is overriden for RHEL based containers otherwise the value is fetched from the Makefile.

@jmelis @bartoszmajsak, correct me if this is incorrect and we need to explictly check for the CentOS target in the cico_setup.sh script.

@hemanik
Copy link
Copy Markdown
Member Author

hemanik commented Jul 3, 2018

Thanks @jmelis @bartoszmajsak for your review. I have incorporated the suggested changes.

@MatousJobanek
Copy link
Copy Markdown
Contributor

[test]

@alien-ike alien-ike added size/M and removed size/L labels Jul 13, 2018
Comment thread .make/Makefile.deploy.prow Outdated
$(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)/$(OC_PROJECT_NAME)-$< -f $(DEPLOY_DOCKERFILE) .
$(DOCKER) tag $(REGISTRY)/$(IMG_REPO)/$(OC_PROJECT_NAME)-$< $(REGISTRY)/$(IMG_REPO)/$(OC_PROJECT_NAME)-$<:$(TAG)
Copy link
Copy Markdown
Contributor

@MatousJobanek MatousJobanek Jul 13, 2018

Choose a reason for hiding this comment

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

Am I missing something or does the combination of:
https://github.com/arquillian/ike-prow-plugins/pull/218/files#diff-66536a55e28a60c7e24d2d4a43a8b89cR64
export IMG_REPO="openshiftio/rhel-"
with
$(REGISTRY)/$(IMG_REPO)/$(OC_PROJECT_NAME)-$<
results in
quay.io/openshiftio/rhel-/ike-prow-plugins-test-keeper
which is not correct

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@MatousJobanek, you are correct. This is incorrect here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@MatousJobanek, you are correct. This is incorrect.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@hemanik Is there a fix coming for it though? I can't see updates and would love to close this off.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@bartoszmajsak, will update it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants