ci-operator: add support for building operator index images#1084
Conversation
|
The code is ready for review, but I'm marking it as |
stevekuznetsov
left a comment
There was a problem hiding this comment.
Can we get an end-to-end test that builds a bundle and an index?
6e7cb69 to
be0bbc3
Compare
|
Current status of work: the Other issues that need to be worked on:
|
|
@AlexNPavel sounds good -- do we still explicitly ask the user to configure the index build or implicitly create it when bundles are configured? I agree that updating the secret available to the e2e and moving static definitions (as minimal as possible) into this repo are good next steps |
|
E2E tests for the bundle now use the manifests from the PR they are being run against. |
236b3ba to
7ff5206
Compare
|
This PR has been updated, rebased, and cleaned up. It should be ready once we update the pull credentials for the |
We still require it to be explicitly specified. I'm looking into how to handle it implicitly. |
|
/assign Will look! For the record, my intention was to first make the specifications explicit and after the functionality is validated I wanted to followup with a "infer indexes from bundle presence" story to have smaller iterations. |
stevekuznetsov
left a comment
There was a problem hiding this comment.
Code looks good except for the explicit flow, couple comments
| os::test::junit::declare_suite_end | ||
|
|
||
| os::test::junit::declare_suite_start "e2e/simple/optional-operator" | ||
| if [[ -z "${PULL_BASE_SHA:-}" ]]; then |
There was a problem hiding this comment.
Confused about these, and why $JOB_SPEC doesn't cover it?
There was a problem hiding this comment.
It should. Changed to use that instead.
| os::log::fatal "\$PULL_PULL_SHA must be set for this test" | ||
| fi | ||
| export JOB_SPEC='{"type":"postsubmit","job":"branch-ci-openshift-ci-tools-master-ci-operator-e2e","buildid":"0","prowjobid":"uuid","refs":{"org":"openshift","repo":"ci-tools","base_ref":"master","base_sha":"'"${PULL_BASE_SHA}"'","pulls":[{"number":'"${PULL_NUMBER}"',"sha":"'"${PULL_PULL_SHA}"'","author":"AlexNPavel"}]}}' | ||
| os::cmd::expect_success "ci-operator --image-import-pull-secret ${PULL_SECRET_DIR}/.dockerconfigjson --target [images] --config ${suite_dir}/optional-operators.yaml" |
There was a problem hiding this comment.
Could we somehow write a simple, lightweight tests step in this config that either runs in the index or uses my PR to depend on the index image and does something trivial to validate that the index is workable?
petr-muller
left a comment
There was a problem hiding this comment.
Code LGTM, not approving b/c I see Steve has some comments.
|
/test e2e |
f46cf00 to
e035012
Compare
c8c950e to
a351a87
Compare
2575178 to
3a16d37
Compare
This PR adds support for building operator index images by adding an `operator_index` field for images. The process is handled in a similar manner to the bundle images, which require 2 steps, with the first step involving building a new image to be used as a source image. First, an image build is made that runs the `opm` command that generates the `index.db` file and a dockerfile to build the corresponding index image. Second, a build is made with the previous build's image as its source, using the dockerfile generated by `opm`. This PR also adds validation for the `images` section of the config as both `operator_manifests` and `operator_index` add potential for user error.
3a16d37 to
a8025c9
Compare
23edb64 to
5b8a34d
Compare
| } | ||
|
|
||
| var expectedDockerfileSingleBundle = ` | ||
| FROM quay.io/operator-framework/upstream-opm-builder AS builder |
There was a problem hiding this comment.
Technically would be good to import these as base_images to the namespace so that they're considered when detecting the version of the job and so that we're not reliant on external registries/doing cluster-local pulls
| os::test::junit::declare_suite_end | ||
|
|
||
| os::test::junit::declare_suite_start "e2e/simple/optional-operator" | ||
| if [[ -z "${PULL_BASE_SHA:-}" ]]; then |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AlexNPavel, stevekuznetsov The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This PR addresses a variety of comments from openshift#1084 that were unaddressed when the PR merged. These are the changes: - Make functions to create bundle image name and detect if image is bundle name - Add brief Godoc for api.Bundle - Use `find` command directly in bundle substitution instead of executing through bash - Use exact pullspecs from ResolvePullSpec, which also verifies that the image tag exists - Add image substitutions that get built in the pipeline to the required images for bundle-sub - Don't change global state (changing directory) in unit tests - Handle both yaml and yml file extensions for manifests - Handle escaping in dockerfile more cleanly - Remove extra, empty "" lines from beginning and end of generated dockerfiles - Expand replaceCommand unit tests by adding a .yml and .txt file
This PR addresses a variety of comments from openshift#1084 that were unaddressed when the PR merged. These are the changes: - Make functions to create bundle image name and detect if image is bundle name - Add brief Godoc for api.Bundle - Use `find` command directly in bundle substitution instead of executing through bash - Use exact pullspecs from ResolvePullSpec, which also verifies that the image tag exists - Add image substitutions that get built in the pipeline to the required images for bundle-sub - Don't change global state (changing directory) in unit tests - Handle both yaml and yml file extensions for manifests - Handle escaping in dockerfile more cleanly - Remove extra, empty "" lines from beginning and end of generated dockerfiles - Expand replaceCommand unit tests by adding a .yml and .txt file
This PR adds support for building operator index images by adding an
operator_indexfield for images. The process is handled in a similarmanner to the bundle images, which require 2 steps, with the first step
involving building a new image to be used as a source image.
First, an image build is made that runs the
opmcommand that generatesthe
index.dbfile and a dockerfile to build the corresponding indeximage.
Second, a build is made with the previous build's image as its source,
using the dockerfile generated by
opm.This PR also adds validation for the
imagessection of the config asboth
operator_manifestsandoperator_indexadd potential for usererror.