Skip to content

Commit

Permalink
ci: delete CL build branches once workflow is complete
Browse files Browse the repository at this point in the history
In ccbfbd2 we introduced the concept of build branches that are used
for CL CI workflows. However we stopped short of deleting those build
branches to ensure that the workflow behaved as intended on master.

There have been two subsequent master builds, a pass and a fail, that
verify this remove step is not running for a master build:

https://github.com/cuelang/cue/actions/runs/488463317 (fail)
https://github.com/cuelang/cue/actions/runs/488888616 (pass)

Hence it is now safe to remove build branches at the end of a CL
workflow.

Change-Id: Iad673771470e50d2e568e2caf451fc21a41a573e
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/8226
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Paul Jolly <paul@myitcv.org.uk>
  • Loading branch information
myitcv committed Jan 15, 2021
1 parent 8c41622 commit ed7d254
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,11 @@ jobs:
run:
shell: bash
steps:
- run: echo git push origin :${GITHUB_REF#refs/heads/}
- run: |-
mkdir tmpgit
cd tmpgit
git init
git config user.name cueckoo
git config user.email cueckoo@gmail.com
git config http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)"
git push https://github.com/cuelang/cue :${GITHUB_REF#refs/heads/}
23 changes: 15 additions & 8 deletions internal/ci/workflows.cue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ test: _#bashWorkflow & {
needs: "test"
steps: [
_#step & {
run: "echo git push origin :${GITHUB_REF#\(_#branchRefPrefix)}"
run: """
\(_#tempCueckooGitDir)
git push https://github.com/cuelang/cue :${GITHUB_REF#\(_#branchRefPrefix)}
"""
},
]
}
Expand Down Expand Up @@ -155,13 +158,8 @@ test_dispatch: _#bashWorkflow & {
},
_#step & {
name: "Checkout ref"
run: """
mkdir tmpgit
cd tmpgit
git init
git config user.name cueckoo
git config user.email cueckoo@gmail.com
git config http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)"
run: """
\(_#tempCueckooGitDir)
git fetch https://cue-review.googlesource.com/cue ${{ github.event.client_payload.ref }}
git checkout -b ci/${{ github.event.client_payload.changeID }}/${{ github.event.client_payload.commit }} FETCH_HEAD
git push https://github.com/cuelang/cue ci/${{ github.event.client_payload.changeID }}/${{ github.event.client_payload.commit }}
Expand Down Expand Up @@ -339,3 +337,12 @@ _#writeCookiesFile: _#step & {
}

_#branchRefPrefix: "refs/heads/"

_#tempCueckooGitDir: """
mkdir tmpgit
cd tmpgit
git init
git config user.name cueckoo
git config user.email cueckoo@gmail.com
git config http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)"
"""

0 comments on commit ed7d254

Please sign in to comment.