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

push image to multiple registry #1079

Merged

Conversation

sarathchandra24
Copy link
Collaborator

Push images to multiple registries; images: fluentbit, fluent-operator

What this PR does / why we need it:

Current system is pushing images to only single registry: Docker Hub;

We want to push images to other registries too; to solve this we are pushing every image to GitHub Container Registry and then we only release image to docker hub if they are changes towards master or tags.

This is a new PR for the requested changes in #1071

Which issue(s) this PR fixes:

Fixes #1068

Does this PR introduced a user-facing change?


Additional documentation, usage docs, etc.:

We are currently defining default image names and tags
kubesphere/fluent-bit:v2.2.2
kubesphere/fluent-bit:v2.2.2-debug

This commit would be changed to tag based versioning; if a new git tag is released, new tag would be used for images.

Images will be pushing to gchr.io/fluent/fluent-operator/{imageName}:{imageVersion}


sarathchandra24 and others added 3 commits March 6, 2024 15:36
Signed-off-by: Sarath Chandra Oruganti <[email protected]>
Signed-off-by: Sarath Chandra Oruganti <[email protected]>
Signed-off-by: Sarath Chandra Oruganti <[email protected]>
Signed-off-by: Sarath Chandra Oruganti <[email protected]>
Signed-off-by: Sarath Chandra Oruganti <[email protected]>
@sarathchandra24
Copy link
Collaborator Author

I made a release on my fork and here are the jobs
fluent bit
fluentd
fluent operator

Github packages: I created a tag v17.0.2 and here are the packages;
fluent-bit:v17.0.2
fluent-bit:v17.0.2-debug
fluentd:v17.0.2
fluent-operator:v17.0.2

Docker Hub:
fluent-bit:17.0.2
fluent-bit:17.0.2-debug
fluentd:17.0.2
fluent-operator:17.0.2

uses: hands-lab/dockle-action@v1
with:
image: ${{ inputs.source_registry }}/${{ inputs.source_image }}
exit-code: "0"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ignoring error current need to change to 1 so that we will stop releasing image to docker hub. need suggestion.

Copy link
Member

Choose a reason for hiding this comment

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

You mean we needn't to sync images to dockerhub in a scan image action?

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 can continue the scan regardless the scan result.
Let's keep it as 0

docker run --rm \
quay.io/skopeo/stable:latest \
copy \
--all \
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Might have to add --additional-tag "latest" that creates a latest tag while copying currently it is not copying, need suggestion.

Copy link
Member

@benjaminhuo benjaminhuo Mar 8, 2024

Choose a reason for hiding this comment

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

it's ok to leave the latest on ghcr only, we can add a note in the repo's readme saying users can fetch latest image from ghcr if they want .

And of course sync the latest to dockerhub is also reasonable

.github/workflows/build-fb-image.yaml Show resolved Hide resolved
password: ${{ secrets.REGISTRY_PASSWORD }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
Copy link
Member

@benjaminhuo benjaminhuo Mar 8, 2024

Choose a reason for hiding this comment

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

Do I need to add a GitHub token to this repo's action secret?
But that token cannot start with Github, maybe we can change it to GH_TOKEN ?

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As far as I know of I am using GITHUB_TOKEN only which will restrict permissions defined in the actions. I referred to the following document. I allowed the write permissions globally on a repo, and use this clause in actions

permissions:
  contents: read
  packages: write
Allow Permissions on github

Let's check if this works! if not we can create a secret GH_TOKEN and use it.

Copy link
Member

Choose a reason for hiding this comment

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

all right, looks like GITHUB_TOKEN is created automatically for each action and I need to create one manually

.github/workflows/build-op-image.yaml Show resolved Hide resolved
@benjaminhuo
Copy link
Member

@sarathchandra24 Thanks for the great effort, I'm going to add you as maintainer

@benjaminhuo benjaminhuo merged commit 7f91cc0 into fluent:master Mar 8, 2024
14 of 17 checks passed
chrono2002 pushed a commit to chrono2002/fluent-operator that referenced this pull request Mar 12, 2024
* push image to multiple registry

Signed-off-by: Sarath Chandra Oruganti <[email protected]>
Signed-off-by: Sarath Chandra Oruganti <[email protected]>

* github actions permissions

Signed-off-by: Sarath Chandra Oruganti <[email protected]>
Signed-off-by: Sarath Chandra Oruganti <[email protected]>

* fluentd multi registry image push

Signed-off-by: Sarath Chandra Oruganti <[email protected]>

* Limit build to PR changes for certain files

Signed-off-by: Sarath Chandra Oruganti <[email protected]>

---------

Signed-off-by: Sarath Chandra Oruganti <[email protected]>
Signed-off-by: Sarath Chandra Oruganti <[email protected]>
Signed-off-by: Paul Smith <[email protected]>
type=ref,event=branch
type=ref,event=pr
type=ref,event=tag
type=semver,pattern={{version}}
Copy link
Member

@benjaminhuo benjaminhuo May 23, 2024

Choose a reason for hiding this comment

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

There is a problem here that the fluent-operator and fluent bit have different version, and in this action it use the tag of fluent-operator to build fluentbit images:

when we released fluent-operator v2.8.0, the fluentbit remains 2.2.2, but fluent-bit:v2.8.0 is built instead
image

and this is the cause of #1178

The make file should be used to build fluentbit images instead https://github.com/fluent/fluent-operator/blob/v2.8.0/Makefile#L3

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

@sarathchandra24 sarathchandra24 May 25, 2024

Choose a reason for hiding this comment

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

hmm, let me know if my understanding is correct.

If we are releasing a tag suppose v2.8.0, it is building three images fluentd:v2.8.0, fluent-operator:v2.8.0 and fluent-bit:v2.8.0. As per the workflows, all the images are using tags to release new images.

Do we need to separate them; i.e. are these images having different build and release cycles?

Copy link
Member

@benjaminhuo benjaminhuo May 26, 2024

Choose a reason for hiding this comment

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

If we are releasing a tag suppose v2.8.0, it is building three images fluentd:v2.8.0, fluent-operator:v2.8.0 and fluent-bit:v2.8.0. As per the workflows, all the images are using tags to release new images.

Do we need to separate them; i.e. are these images having different build and release cycles?

@sarathchandra24 Yes, we need to separate them. The tag of this project should only be used to build fluent-operator while the fluentbit and fluentd have separate tags as defined in the makefile:

fluentbit:
https://github.com/fluent/fluent-operator/blob/master/Makefile#L3

fluend:
https://github.com/fluent/fluent-operator/blob/master/Makefile#L5

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.

kubesphere fluent* images should be published to multiple registries
2 participants