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

Production file-based catalog specific for OCP versions #2926

Merged
merged 33 commits into from
Oct 11, 2024

Conversation

mgencur
Copy link
Contributor

@mgencur mgencur commented Oct 8, 2024

@mgencur
Copy link
Contributor Author

mgencur commented Oct 8, 2024

The build error is cause by the fact that two versions replace the same previous version:

{
            "name": "serverless-operator.v1.33.2",
            "replaces": "serverless-operator.v1.33.0",
            "skipRange": ">=1.33.0 <1.33.2"
        },
        {
            "name": "serverless-operator.v1.35.0",
            "replaces": "serverless-operator.v1.34.0",
            "skipRange": ">=1.34.0 <1.35.0"
        },
        {
            "name": "serverless-operator.v1.34.0",
            "replaces": "serverless-operator.v1.33.0",
            "skipRange": ">=1.33.0 <1.34.0"
        }

@mgencur
Copy link
Contributor Author

mgencur commented Oct 9, 2024

Getting this error in the github action:

401 Unauthorized" host=registry.redhat.io
time="2024-10-09T10:08:07Z" level=fatal msg="render catalog image: render reference

Probably we don't have the right credentials yet.

env:
REGISTRY_REDHAT_IO_USERNAME: ${{ secrets.REGISTRY_REDHAT_IO_USERNAME }}
REGISTRY_REDHAT_IO_PASSWORD: ${{ secrets.REGISTRY_REDHAT_IO_PASSWORD }}
run: make generated-files generate-catalog
Copy link
Member

Choose a reason for hiding this comment

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

I'd include generate-catalog in generated-files so that others don't need to learn about this new command to run ?

Copy link
Contributor Author

@mgencur mgencur Oct 9, 2024

Choose a reason for hiding this comment

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

The command "generate-catalog" takes a looot of time. About 1/2 hour on my localhost. Maybe it will be faster in the github action but let's see.
The other problem is that it requires credentials to registry.redhat.io and those are not available in github actions that run "on-pull-request".
I'm going to push a little change to split this. We could run "generate-catalog" only periodically or on-push.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pushed the split.

Copy link
Member

Choose a reason for hiding this comment

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

wow 1/2 hour

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright. In github action it's much faster. About 5 minutes:

11:28:54.752 INFO:    Generating catalog for OCP 4.13
time="2024-10-11T11:28:54Z" level=info msg="rendering index \"registry.redhat.io/redhat/redhat-operator-index:v4.13\" as file-based catalog"
time="2024-10-11T11:29:49Z" level=info msg="wrote rendered file-based catalog to \"/tmp/knative.aIjkdvzz/tmp.IiMQGlnAOi\"\n"
11:30:27.698 INFO:    Generating catalog for OCP 4.14
time="2024-10-11T11:30:27Z" level=info msg="rendering index \"registry.redhat.io/redhat/redhat-operator-index:v4.14\" as file-based catalog"
time="2024-10-11T11:31:21Z" level=info msg="wrote rendered file-based catalog to \"/tmp/knative.aIjkdvzz/tmp.s4bv1h7HZi\"\n"
11:31:39.478 INFO:    Generating catalog for OCP 4.15
time="2024-10-11T11:31:39Z" level=info msg="rendering index \"registry.redhat.io/redhat/redhat-operator-index:v4.15\" as file-based catalog"
time="2024-10-11T11:32:31Z" level=info msg="wrote rendered file-based catalog to \"/tmp/knative.aIjkdvzz/tmp.vOKEBnWFRH\"\n"
11:32:48.077 INFO:    Generating catalog for OCP 4.16
time="2024-10-11T11:32:48Z" level=info msg="rendering index \"registry.redhat.io/redhat/redhat-operator-index:v4.16\" as file-based catalog"
time="2024-10-11T11:33:36Z" level=info msg="wrote rendered file-based catalog to \"/tmp/knative.aIjkdvzz/tmp.mKSK5ppXVI\"\n"
11:33:57.680 INFO:    Generating catalog for OCP 4.17
time="2024-10-11T11:33:57Z" level=info msg="rendering index \"registry.redhat.io/redhat/redhat-operator-index:v4.17\" as file-based catalog"
time="2024-10-11T11:34:12Z" level=info msg="wrote rendered file-based catalog to \"/tmp/knative.aIjkdvzz/tmp.TB6GDPKkiP\"\n"

Copy link
Member

Choose a reason for hiding this comment

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

This one doesn't seem to be a valid JSON, there are missing commas

image

Copy link
Member

Choose a reason for hiding this comment

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

and I guess the same for others, but if that's normal, nevermind my noob questions

Copy link
Member

Choose a reason for hiding this comment

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

In the same file I see old CI images

        {
            "name": "knative-openshift-ingress",
            "image": "registry.ci.openshift.org/knative/release-1.34.0:serverless-ingress"
        },
        {
            "name": "knative-openshift",
            "image": "registry.ci.openshift.org/knative/release-1.34.0:serverless-knative-operator"
        },
        {
            "name": "knative-operator",
            "image": "registry.ci.openshift.org/knative/release-1.34.0:serverless-openshift-knative-operator"
        },

Copy link
Member

Choose a reason for hiding this comment

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

shouldn't there be prod images only in this file as that's part of the final release?

Copy link
Member

Choose a reason for hiding this comment

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

I got the same, when I created them as described https://github.com/konflux-ci/olm-operator-konflux-sample/blob/main/docs/konflux-onboarding.md#create-the-fbc-in-the-git-repository

btw: those commands also offer a --output yaml parameter. So the catalog-templat might be easier to maintain later.

Copy link
Member

Choose a reason for hiding this comment

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

what about that comment ? #2926 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

is it correct / what we expect ?

Copy link
Member

Choose a reason for hiding this comment

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

I guess it's here the reply

This will be automatically fixed later. When 1.34 is pushed to the production catalog it will be pulled when calling "generate-catalog" and the script will skip this version and won't add CI images there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. That's the answer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pushed the yaml variant ! I like it much more.

Comment on lines 248 to 253
function latest_registry_ci_sha() {
input=${1:?"Provide image"}

image_without_tag=${input%:*} # Remove tag, if any

go_bin="$(go env GOPATH)/bin"
export GOPATH="$PATH:$go_bin"
digest=$(skopeo inspect --no-tags=true "docker://${input}" | jq -r '.Digest')
if [ "${digest}" = "" ]; then
exit 1
fi

echo "${image_without_tag}@${digest}"
}
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 could reuse latest_konflux_image_sha for this ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will check this. We don't want the "latest" tag though. We want a specific tag, e.g. release-1.34.0. The latest_konflux_image_sha automatically adds "latest"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pushed.

image_without_tag=${input%:*} # Remove tag, if any

go_bin="$(go env GOPATH)/bin"
export GOPATH="$PATH:$go_bin"
Copy link
Member

Choose a reason for hiding this comment

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

not sure, why this is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure. I copied it from the other functions in this file. Looks like it works without this as well. Maybe @pierDipi knows?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the line in the new commit.

Copy link
Member

Choose a reason for hiding this comment

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

not everyone has the go/bin folder in their path and go install installs binaries in go/bin but I'm ok making it a prerequisite

@mgencur mgencur changed the title [WIP] Production file-based catalog specific for OCP versions Production file-based catalog specific for OCP versions Oct 10, 2024
@mgencur
Copy link
Contributor Author

mgencur commented Oct 10, 2024

I built the catalog image locally and deployed to OpenShift, and it works!
image

After building the image I just ran these two commands that install the CatalogSource.

export INDEX_IMAGE=quay.io/mgencur/serverless-index:release-1.35.0-4.17
./hack/dev.sh

@pierDipi
Copy link
Member

Awesome!

@creydr
Copy link
Member

creydr commented Oct 10, 2024

Awesome 🎉

@pierDipi
Copy link
Member

/lgtm

@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD dc130e1 and 2 for PR HEAD 4783016 in total

1 similar comment
@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD dc130e1 and 2 for PR HEAD 4783016 in total

@mgencur
Copy link
Contributor Author

mgencur commented Oct 11, 2024

One thing that is missing from this PR is replacing konflux reference to the bundle image with registry.redhat.io (after generating the catalog). And also deploying ImageContentSourcePolicy for this. But I will do this in a follow-up PR.

I had to do a rebase because of some other changes so I added a couple of commits and fixed the above as well.

Copy link
Member

@creydr creydr left a comment

Choose a reason for hiding this comment

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

/lgtm

Copy link
Contributor

openshift-ci bot commented Oct 11, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: creydr, mgencur, pierDipi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [creydr,mgencur,pierDipi]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@creydr
Copy link
Member

creydr commented Oct 11, 2024

/test 416-test-upgrade-aws-416

@openshift-merge-bot openshift-merge-bot bot merged commit 51a4642 into openshift-knative:main Oct 11, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants