karmada-io / karmada

Open, Multi-Cloud, Multi-Cluster Kubernetes Orchestration
https://karmada.io
Apache License 2.0
4.11k stars 805 forks source link

Add workflows to publish latest image automatically #395

Closed RainbowMango closed 2 years ago

RainbowMango commented 2 years ago

What type of PR is this? /kind cleanup

What this PR does / why we need it: When a new push happened on the master branch (such as merged a PR), the workflows will build the latest images and upload them to the registry.

Which issue(s) this PR fixes: Fixes #

Special notes for your reviewer:

  1. The workflow only running on the upstream repo, (ignored from forked repository) I've tested on my forked repository, please refer to here.
  2. The secrets used by the workflow configured only on the upstream repository and would never be logged out.
    SWR_REGISTRY= ***
    SWR_REGISTRY_PASSWORD= ***
    SWR_REGISTRY_SERVER_ADDRESS= ***
    SWR_REGISTRY_USER_NAME= ***

    Does this PR introduce a user-facing change?:

    NONE

/hold for @kevin-wangzefeng @XiShanYongYe-Chang @daixiang0 take a look.

daixiang0 commented 2 years ago

I think it is enough to build daily, no need to build with each commits.

RainbowMango commented 2 years ago

I think it is enough to build daily, no need to build with each commits.

I guess you mean to run the workflows by onschedule.

What's your concern about running on each push event?

daixiang0 commented 2 years ago

It is useless since there is only one latest image.

Also all commits should be merged by pr, push event still works for them?

kevin-wangzefeng commented 2 years ago

It needs to make sure CI pass before pushing image

RainbowMango commented 2 years ago

Also all commits should be merged by pr, push event still works for them?

Yes, I think so.

pigletfly commented 2 years ago

Should we publish image to docker hub as well ?

kevin-wangzefeng commented 2 years ago

Should we publish image to docker hub as well ?

Dockerhub has limited bandwidth for free open source projects, we can use the Github Container registry (ghcr.io) instead.

Ref: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry

RainbowMango commented 2 years ago

/assign @kevin-wangzefeng

RainbowMango commented 2 years ago

/hold cancel

karmada-bot commented 2 years ago

New changes are detected. LGTM label has been removed.

RainbowMango commented 2 years ago

Seems in this PR, we have a Skipped jobs defined in the workflow, tide failed to merge the PR... @daixiang0 Do you know why?

RainbowMango commented 2 years ago

/hold

RainbowMango commented 2 years ago

Found an error from tide, and don't know why yet.

{"base-sha":"ff11128c69551df5c500d7b2ea9adbd8edb46b48","branch":"master","component":"tide","controller":"sync","error":"status code 422 not one of [201], body: {\"message\":\"Validation Failed\",\"errors\":[{\"resource\":\"Status\",\"code\":\"custom\",\"message\":\"This SHA and context has reached the maximum number of statuses.\"}],\"documentation_url\":\"https://docs.github.com/rest/reference/repos#create-a-commit-status\"}","file":"prow/tide/tide.go:1207","func":"k8s.io/test-infra/prow/tide.(*Controller).mergePRs","level":"error","merge-targets":[395],"msg":"Unable to set tide context to SUCCESS.","org":"karmada-io","pr":395,"repo":"karmada","severity":"error","sha":"dc5657513c6781010e51e9216a85fc34836b609f","time":"2021-06-05T02:37:48Z"}
daixiang0 commented 2 years ago

Seems its check logic needs optimization, please see doc, maybe skip-unknown-contexts help.

RainbowMango commented 2 years ago

Thanks @daixiang0 !!!, Let's give it a try.

/hold cancel

karmada-bot commented 2 years ago

New changes are detected. LGTM label has been removed.

RainbowMango commented 2 years ago
+      context_options:
+        # Treat unknown contexts as optional
+        skip-unknown-contexts: true

Added skip-unknown-contexts global configuration, seems still not working.

daixiang0 commented 2 years ago

Try update image version, if still failed, may ask in its slack.

karmada-bot commented 2 years ago

New changes are detected. LGTM label has been removed.

karmada-bot commented 2 years ago

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

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](https://github.com/karmada-io/karmada/blob/master/OWNERS)** Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
karmada-bot commented 2 years ago

New changes are detected. LGTM label has been removed.

RainbowMango commented 2 years ago

Don't have time to dig out the reason why prow failed to ignore the skipped jobs. Moving forward with the temporary solution. /hold cancel

RainbowMango commented 2 years ago

/hold as tide still can't merge...

daixiang0 commented 2 years ago

close pr, restart tide and reopen

karmada-bot commented 2 years ago

New changes are detected. LGTM label has been removed.