Skip to content

Commit

Permalink
ci: only trigger new version events after successful new version
Browse files Browse the repository at this point in the history
Fixes cue-lang#1411

Signed-off-by: Paul Jolly <paul@myitcv.io>
Change-Id: I71937b542167f52fd37b9429e8e2f32120c47157
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/528606
Unity-Result: CUEcueckoo <cueckoo@cuelang.org>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
  • Loading branch information
myitcv committed Dec 2, 2021
1 parent 795719e commit 6e68ca4
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 345 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/new_version_triggers.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ jobs:
version: v1.1.0
env:
GITHUB_TOKEN: ${{ secrets.CUECKOO_GITHUB_PAT }}
- name: Re-test cuelang.org
run: 'curl -f -s -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary "{\"event_type\":\"Re-test post release of ${GITHUB_REF##refs/tags/}\"}" https://api.github.com/repos/cue-lang/cuelang.org/dispatches'
- name: Trigger unity build
run: 'curl -f -s -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary "{\"event_type\":\"Check against CUE ${GITHUB_REF##refs/tags/}\",\"client_payload\":{\"type\":\"unity\",\"payload\":{\"versions\":\"\\\"${GITHUB_REF##refs/tags/}\\\"\"}}}" https://api.github.com/repos/cue-lang/unity/dispatches'
46 changes: 19 additions & 27 deletions cmd/cue/cmd/testdata/script/cmd_github.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ cue cmd genworkflows

# TODO: drop cd when we solve cuelang.org/issue/708
cd ../../
cmp .github/workflows/new_version_triggers.yml .github/workflows/new_version_triggers.yml.golden
cmp .github/workflows/release.yml .github/workflows/release.yml.golden
cmp .github/workflows/repository_dispatch.yml .github/workflows/repository_dispatch.yml.golden
cmp .github/workflows/test.yml .github/workflows/test.yml.golden
Expand Down Expand Up @@ -107,6 +106,10 @@ jobs:
version: v1.1.0
env:
GITHUB_TOKEN: ${{ secrets.CUECKOO_GITHUB_PAT }}
- name: Re-test cuelang.org
run: 'curl -f -s -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary "{\"event_type\":\"Re-test post release of ${GITHUB_REF##refs/tags/}\"}" https://api.github.com/repos/cue-lang/cuelang.org/dispatches'
- name: Trigger unity build
run: 'curl -f -s -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary "{\"event_type\":\"Check against CUE ${GITHUB_REF##refs/tags/}\",\"client_payload\":{\"type\":\"unity\",\"payload\":{\"versions\":\"\\\"${GITHUB_REF##refs/tags/}\\\"\"}}}" https://api.github.com/repos/cue-lang/unity/dispatches'
-- .github/workflows/repository_dispatch.yml.golden --
# Generated by internal/ci/ci_tool.cue; do not edit

Expand Down Expand Up @@ -1119,9 +1122,6 @@ workflows: [...{
}, {
file: "tip_triggers.yml"
schema: tip_triggers
}, {
file: "new_version_triggers.yml"
schema: new_version_triggers
}]
test: _#bashWorkflow & {
name: "Test"
Expand Down Expand Up @@ -1281,24 +1281,19 @@ release: _#bashWorkflow & {
args: "release --rm-dist"
version: "v1.1.0"
}
}]
}
}
tip_triggers: _#bashWorkflow & {
name: "Push to tip triggers"
on: push: branches: [_#masterBranch]
jobs: push: {
"runs-on": _#linuxMachine
steps: [{
name: "Rebuild tip.cuelang.org"
run: "\(_#curl) -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.CuelangOrgTipRebuildHook }}"
}, {
}, _#step & {
_#arg: {
event_type: "Check against ${GITHUB_SHA}"
event_type: "Re-test post release of ${GITHUB_REF##refs/tags/}"
}
name: "Re-test cuelang.org"
run: "\(_#curl) -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \(strconv.Quote(encjson.Marshal(_#arg))) https://api.github.com/repos/cue-lang/cuelang.org/dispatches"
}, _#step & {
_#arg: {
event_type: "Check against CUE ${GITHUB_REF##refs/tags/}"
client_payload: {
type: "unity"
payload: versions: """
"commit:${GITHUB_SHA}"
"${GITHUB_REF##refs/tags/}"
"""
}
}
Expand All @@ -1307,24 +1302,21 @@ tip_triggers: _#bashWorkflow & {
}]
}
}
new_version_triggers: _#bashWorkflow & {
name: "New release triggers"
on: push: tags: [_#releaseTagPattern]
tip_triggers: _#bashWorkflow & {
name: "Push to tip triggers"
on: push: branches: [_#masterBranch]
jobs: push: {
"runs-on": _#linuxMachine
steps: [{
_#arg: {
event_type: "Re-test post release of ${GITHUB_REF##refs/tags/}"
}
name: "Rebuild tip.cuelang.org"
run: "\(_#curl) -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \(strconv.Quote(encjson.Marshal(_#arg))) https://api.github.com/repos/cue-lang/cuelang.org/dispatches"
run: "\(_#curl) -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.CuelangOrgTipRebuildHook }}"
}, {
_#arg: {
event_type: "Check against CUE ${GITHUB_REF##refs/tags/}"
event_type: "Check against ${GITHUB_SHA}"
client_payload: {
type: "unity"
payload: versions: """
"${GITHUB_REF##refs/tags/}"
"commit:${GITHUB_SHA}"
"""
}
}
Expand Down
Loading

0 comments on commit 6e68ca4

Please sign in to comment.