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

Using base image from other namespace did not work #179

Closed
henrjk opened this issue Jan 6, 2020 · 4 comments
Closed

Using base image from other namespace did not work #179

henrjk opened this issue Jan 6, 2020 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@henrjk
Copy link
Member

henrjk commented Jan 6, 2020

Describe the bug
I experimented with using a base image created in openshift and then referencing this in the buildConfig as follows:

- apiVersion: build.openshift.io/v1
  kind: BuildConfig
...
  spec:
     strategy:
       dockerStrategy:
         from:
           kind: ImageStreamTag
           name: 'be-python-flask-base:${BASE_TAG}'
          namespace: example-cd
       type: Docker

However during the shared library buildArgs patch created in

def buildArgsPatch = """{"op": "replace", "path": "/spec/strategy/dockerStrategy", "value": {"buildArgs": [
replaces the entire dockerStrategy and this removes the from information.

As a consequence the image was attempted to be loaded from the docker registry instead of the internal registry which failed.

I'd be happy to work on a fix unless there was some known reason that a more targeted patch would not work.

To Reproduce
I don't have something I can share ready. Please ask if clarification is needed.

Expected behavior
The patch should only add build args and leave other pieces of the dockerStrategy alone.

Affected version (please complete the following information):

  • OpenShift:3.11
  • OpenDevStack master
@henrjk henrjk added the bug Something isn't working label Jan 6, 2020
@michaelsauter
Copy link
Member

I don't see a major reason why the more targeted approach would not work. One reason that the whole thing was updated may be that - IIRC - a replace operation also adds the entry if it does not exist. Please check. However, even if this is the case, I would support going to the narrower approach as it gives you the functionality needed, and has fewer surprises. We would only need to document this "breaking" change - which is breaking in theory, but no users should be affected by it ...

@michaelsauter michaelsauter changed the title Using base image from namespace did not work Using base image from other namespace did not work Jan 10, 2020
@michaelsauter
Copy link
Member

michaelsauter commented Jan 10, 2020

@henrjk Looking at this again, the issue should ONLY happen if you pass custom buildArgs. Are you doing this actually?

@henrjk
Copy link
Member Author

henrjk commented Jan 10, 2020

This happed with the following in Jenkinsfile:

odsPipeline(
...
  stageStartOpenshiftBuild(context, [nexusHostWithBasicAuth: context.nexusHostWithBasicAuth, nexusHostWithoutScheme: context.nexusHost.tokenize('//')[1]])

which ultimately stems from here:

https://github.com/opendevstack/ods-quickstarters/blob/7f8c371a14e3c1dd64c48dcbad404f3949b11350/be-python-flask/Jenkinsfile.template#L34

@michaelsauter
Copy link
Member

@henrjk Right, this is the default Python Jenkinsfile. For other quickstarters, the issue is not triggered because other quickstarters do not use the buildArgs.

Now it makes sense to me why I was sure it was working while you were sure it was not working :D

@michaelsauter michaelsauter added this to To Do in OpenDevStack 3.0 via automation Jan 13, 2020
@michaelsauter michaelsauter self-assigned this Apr 2, 2020
@michaelsauter michaelsauter moved this from To Do to In Progress in OpenDevStack 3.0 Apr 7, 2020
OpenDevStack 3.0 automation moved this from In Progress to Done Apr 8, 2020
michaelsauter pushed a commit to BIX-Digital/ods-jenkins-shared-library that referenced this issue Apr 27, 2020
… status of the pipeline (opendevstack#179)

Co-authored-by: 8vicat <martsec@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Development

No branches or pull requests

2 participants