Skip to content

Commit

Permalink
internal/ci: improve push_tip_to_trybot defaults
Browse files Browse the repository at this point in the history
Every parameter to this workflow is itself ultimately a value that can
be derived from the base package parameters. So push the values down.

Whilst we are here, get rid of the separate files for the
push_tip_to_trybot and trybot_dispatch workflows in the github package.
These are one-liners more easily covered in the workflows.cue file.

Also switch to using bashWorkflow in a couple of places instead of
reinventing the wheel.

Signed-off-by: Paul Jolly <paul@myitcv.io>
Change-Id: I0b97fe027452c9b2185858ac2e099fad636dcae8
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/551830
Unity-Result: CUEcueckoo <cueckoo@cuelang.org>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
  • Loading branch information
myitcv committed Mar 28, 2023
1 parent 646e965 commit be0601b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/push_tip_to_trybot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
defaults:
run:
shell: bash
if: ${{github.repository == 'cue-lang/cue'}}
steps:
- name: Write netrc file for cueckoo Gerrithub
run: |-
Expand Down Expand Up @@ -47,4 +48,3 @@ jobs:
echo "Giving up"
exit 1
fi
if: ${{github.repository == 'cue-lang/cue'}}
12 changes: 10 additions & 2 deletions internal/ci/base/gerrithub.cue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/SchemaStore/schemastore/src/schemas/json"
)

trybotDispatchWorkflow: json.#Workflow & {
trybotDispatchWorkflow: bashWorkflow & {
_#branchNameExpression: "\(trybot.key)/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }}/${{ steps.gerrithub_ref.outputs.gerrithub_ref }}"
name: "Dispatch \(trybot.key)"
on: ["repository_dispatch"]
Expand Down Expand Up @@ -50,9 +50,17 @@ trybotDispatchWorkflow: json.#Workflow & {
}
}

pushTipToTrybotWorkflow: json.#Workflow & {
pushTipToTrybotWorkflow: bashWorkflow & {
jobs: [string]: defaults: run: shell: "bash"

on: {
push: branches: protectedBranchPatterns
}
jobs: push: {
"runs-on": linuxMachine
if: "${{github.repository == '\(githubRepositoryPath)'}}"
}

name: "Push tip to \(trybot.key)"

concurrency: "push_tip_to_trybot"
Expand Down
28 changes: 0 additions & 28 deletions internal/ci/github/push_tip_to_trybot.cue

This file was deleted.

18 changes: 0 additions & 18 deletions internal/ci/github/trybot_dispatch.cue

This file was deleted.

6 changes: 3 additions & 3 deletions internal/ci/github/workflows.cue
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ import (
workflows: close({
[string]: json.#Workflow

(_repo.trybot.key): _
trybot_dispatch: _
(_repo.trybot.key): _
trybot_dispatch: _repo.trybotDispatchWorkflow
release: _
tip_triggers: _
push_tip_to_trybot: _
push_tip_to_trybot: _repo.pushTipToTrybotWorkflow
evict_caches: _
})

0 comments on commit be0601b

Please sign in to comment.