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

Add sdk base image #3902

Merged
merged 1 commit into from Sep 29, 2020
Merged

Conversation

asmacdo
Copy link
Member

@asmacdo asmacdo commented Sep 17, 2020

The docker image builds, but we need to exercise the tag/push logic before merge
/hold

This PR results in the creation of 4 new images published to quay:

  • quay.io/repository/operator-framework/operator-sdk-amd64
  • quay.io/repository/operator-framework/operator-sdk-s390x
  • quay.io/repository/operator-framework/operator-sdk-ppc64le
  • quay.io/repository/operator-framework/operator-sdk-arm64

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 17, 2020
Copy link
Member

@joelanford joelanford left a comment

Choose a reason for hiding this comment

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

One suggestion and one thing to fix for multi-arch manifest building.


image-push-sdk:
./hack/image/push-image-tags.sh $(OPERATOR_SDK_IMAGE):dev $(OPERATOR_SDK_IMAGE)

Copy link
Member

Choose a reason for hiding this comment

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

I think we also need an image-push-sdk-multiarch target.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can you elaborate on this? I figured we only needed amd64 since we are building FROM ubi-8. Do we need to support other bases as well?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I think we should build it as a multi-arch image supporting all of the architectures that we produce the SDK binary for.

ubi8 is already a multiarch manifest so it should "just work" with all of the architectures we care about. I think we can just mimic what we do for the helm and ansible images.

@@ -0,0 +1,3 @@
FROM registry.access.redhat.com/ubi8/ubi

COPY operator-sdk-dev-linux-gnu /usr/local/bin/operator-sdk
Copy link
Member

Choose a reason for hiding this comment

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

Nit, and can definitely be done later...

WDYT about making this a multi-stage dockerfile where stage 1 copies in the project and builds it, and stage 2 copies the binary from stage 1?

That would eliminate the need for the hack/image/build-sdk-image.sh script, and would be a good exemplar to convert the other image build scripts and Dockefiles over.

Copy link
Member

Choose a reason for hiding this comment

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

Actually it does look like a script may still be necessary so that we can centralize the logic around building the image and then loading it into kind. We could have a generic script (e.g. ./build-image.sh` that takes a context directory, Dockerfile, and image name) that does this work.

Given that, a follow-on probably makes more sense to do a standalone refactor of the existing Dockerfiles, build scripts, and Makefile targets.

Copy link
Member

Choose a reason for hiding this comment

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

WDYT about also setting:

ENTRYPOINT ["/usr/local/bin/operator-sdk"]

Copy link
Member Author

@asmacdo asmacdo Sep 21, 2020

Choose a reason for hiding this comment

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

@joelanford would that not print the help text exit immediately? Yeah, this simplifies the invocation.

Copy link
Member

@joelanford joelanford left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 23, 2020
@openshift-ci-robot
Copy link

New changes are detected. LGTM label has been removed.

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Sep 23, 2020
@asmacdo
Copy link
Member Author

asmacdo commented Sep 23, 2020

If anyone else needs to test the image builds, this is how I did it:

  1. Enable travis on my fork of this repository
    Screenshot from 2020-09-23 15-30-28

  2. Add environment variables for the build so they push to my quay repository
    Screenshot from 2020-09-23 15-28-19

  3. Create the repositories in quay, and set them to public.

  4. include [travis deploy] in the commit message.
    NOTE: If the test jobs fail, they will cancel the deploy stage, but test jobs can be cancelled.

Screenshot from 2020-09-23 15-28-59

@asmacdo
Copy link
Member Author

asmacdo commented Sep 28, 2020

/retest

@asmacdo
Copy link
Member Author

asmacdo commented Sep 28, 2020

@joelanford I made some substantive changes since you approved.

@asmacdo asmacdo removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 28, 2020
@asmacdo
Copy link
Member Author

asmacdo commented Sep 28, 2020

Rebased latest master, CI was still failing due to dependency problem (ansible 2.10, now pinned to 2.9) that has already been fixed.

Copy link
Member

@estroz estroz left a comment

Choose a reason for hiding this comment

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

One suggestion, otherwise LGTM.

@@ -0,0 +1,5 @@
FROM registry.access.redhat.com/ubi8/ubi
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
FROM registry.access.redhat.com/ubi8/ubi
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest

cp $ROOTDIR/build/operator-sdk-dev-linux-gnu .
docker build -f $ROOTDIR/hack/image/sdk/Dockerfile -t $1 .

# TODO(asmacdo) any reason to load image into kind?
Copy link
Member

Choose a reason for hiding this comment

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

The caller should be doing this.

@jmrodri jmrodri merged commit 98a73ba into operator-framework:master Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants