Uploaded image for project: 'Infrastructure'
  1. Infrastructure
  2. INFRA-25815

GH workflow as pre-condition before merge

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major
    • Resolution: Information Provided
    • None
    • GitHub
    • None
    • CouchDB

    Description

      Hey Infra,

      affected repo: https://github.com/apache/couchdb-fauxton

      I enabled branch protection for the "main" branch and as a pre-condition before merging, there should be a successful run of a gh workflow. So I set the following in the `.asf.yaml`.

      ```
      protected_branches:
          main:
            required_status_checks:
              strict: true
              # contexts are the names of checks that must pass.
              contexts:
                - CI
      ```

      `CI` is the name of the workflow.

      Now, the workflow is a required step before merge, the jobs in the workflow run successful, but it hangs on the "status" for the workflow, see PR https://github.com/apache/couchdb-fauxton/pull/1440

      I'm also now unable to update this PR with the following git error message (but maybe thats expected in the situation):
      ```
      ~/Documents/Developer/CouchDB/couchdb-fauxton git:[main]
      git push -f
      Enumerating objects: 5, done.
      Counting objects: 100% (5/5), done.
      Delta compression using up to 4 threads
      Compressing objects: 100% (2/2), done.
      Writing objects: 100% (3/3), 599 bytes | 599.00 KiB/s, done.
      Total 3 (delta 2), reused 1 (delta 1), pack-reused 0
      remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
      remote: error: GH006: Protected branch update failed for refs/heads/main.
      remote: error: Changes must be made through a pull request. Required status check "CI" is expected. Cannot force-push to this branch
      To github.com:apache/couchdb-fauxton.git
       ! [remote rejected] main -> main (protected branch hook declined)
      error: failed to push some refs to 'github.com:apache/couchdb-fauxton.git'
      ```

      Short discussion at Slack: https://the-asf.slack.com/archives/CBX4TSBQ8/p1716371352538599

      At this stage, I would need the help from Infra.

      In my mind I want to do the following:

      - protect "main" branch (done)
      - Run GH workflow for new and/or updated PR's
      - need at least one approval (done)
      - only allow the merge, if the GH workflow was successful (all jobs inside) - the gh workflow should "report" the status back to Github

      How do I set the "contexts" key correctly in the `.asf.yaml` file?

      Best, Ronny

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users

          People

            Unassigned Unassigned
            ronny Ronny Berndt
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment