Skip to content

Commit

Permalink
Merge pull request #64 from rexagod/run-checks-on-prs
Browse files Browse the repository at this point in the history
Validate PRs
  • Loading branch information
rexagod committed Aug 28, 2023
2 parents 2584550 + 8f9be78 commit f485482
Show file tree
Hide file tree
Showing 13 changed files with 96 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/actions-ci-check.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Actions yaml CI check
on: [pull_request]
on: [push, pull_request]
jobs:
actionlint:
runs-on: ubuntu-latest
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/merge-alertmanager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@ on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' #@daily
pull_request:
paths:
- '.github/workflows/merge-flow.yaml'
- '.github/workflows/merge-alertmanager.yaml'
push:
paths:
- '.github/workflows/merge-flow.yaml'
- '.github/workflows/merge-alertmanager.yaml'

jobs:
alertmanager-merge:
uses: rhobs/syncbot/.github/workflows/merge-flow.yaml@main
uses: ./.github/workflows/merge-flow.yaml
with:
upstream: prometheus/alertmanager
downstream: openshift/prometheus-alertmanager
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/merge-flow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
echo "downstream=$(dirname ${{ inputs.downstream }})" >> $GITHUB_OUTPUT
echo "sandbox=$(dirname ${{ inputs.sandbox }})" >> $GITHUB_OUTPUT
DOWNSTREAM_VERSION=$(curl -sL "https://raw.githubusercontent.com/${{ inputs.downstream }}/${{ inputs.downstream-branch }}/VERSION")
if [ "${DOWNSTREAM_VERSION}" == "" ]; then
if [[ "${DOWNSTREAM_VERSION}" =~ ^$|"404: Not Found" ]]; then
# Strip the trailing URL from the expression.
DOWNSTREAM_VERSION_SED=$(echo "${{ inputs.downstream-version-expression }}" | sed -e 's/\(http[^ ]*\).*$/\1/' -e 's/http[^ ]*$//')
# Strip the leading sed command from the expression.
Expand All @@ -96,7 +96,7 @@ jobs:
exit 1
fi
DOWNSTREAM_VERSION=$(curl --silent "${DOWNSTREAM_VERSION_URL}" | eval "${DOWNSTREAM_VERSION_SED}")
if [ "${DOWNSTREAM_VERSION}" == "" ]; then
if ! [[ "${DOWNSTREAM_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::downstream-version-expression is invalid"
exit 1
fi
Expand All @@ -119,11 +119,11 @@ jobs:
elif [ "${SEMVER_RESULT}" == "=" ]; then
echo "status=uptodate" >> $GITHUB_OUTPUT
echo "::notice::downstream up-to-date"
exit 1
exit 0
else
echo "status=ahead" >> $GITHUB_OUTPUT
echo "::notice::downstream ahead"
exit 1
exit 0
fi
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -188,20 +188,23 @@ jobs:
git diff --cached --exit-code || git commit -s -m "[bot] update rh-manifest.txt"
fi
- name: Get auth token to create pull request for ${{ inputs.downstream }}
if: github.event_name != 'pull_request'
id: pr
uses: getsentry/action-github-app-token@v1
with:
app_id: ${{ secrets.pr-app-id }}
private_key: ${{ secrets.pr-app-private-key }}
scope: ${{ steps.org.outputs.downstream }}
- name: Get auth token to push to ${{ inputs.sandbox }}
if: github.event_name != 'pull_request'
id: cloner
uses: getsentry/action-github-app-token@v1
with:
app_id: ${{ secrets.cloner-app-id }}
private_key: ${{ secrets.cloner-app-private-key }}
scope: ${{ steps.org.outputs.sandbox }}
- name: Create Pull Request
if: github.event_name != 'pull_request'
uses: rhobs/create-pull-request@v3
id: create-pr
with:
Expand Down Expand Up @@ -236,8 +239,8 @@ jobs:
push-to-fork: ${{ inputs.sandbox }}
push-to-fork-token: ${{ steps.cloner.outputs.token }}
- name: Compose slack message body
if: github.event_name != 'pull_request' && (success() || steps.fork-sync.outputs.status == 'uptodate' || steps.fork-sync.outputs.status == 'ahead')
continue-on-error: true
if: success() || steps.fork-sync.outputs.status == 'uptodate' || steps.fork-sync.outputs.status == 'ahead'
id: slack-message
run: |
if [ "${{ steps.create-pr.outputs.pull-request-url }}" == "" ] || [ ${{ steps.fork-sync.outputs.status }} == "uptodate" ] || [ ${{ steps.fork-sync.outputs.status }} == "ahead" ] ; then
Expand All @@ -246,8 +249,8 @@ jobs:
echo "message=PR ${{ steps.create-pr.outputs.pull-request-url }} has been ${{ steps.create-pr.outputs.pull-request-operation || 'updated' }}." >> $GITHUB_OUTPUT
fi
- uses: 8398a7/action-slack@v3
if: github.event_name != 'pull_request' && (success() || steps.fork-sync.outputs.status == 'uptodate' || steps.fork-sync.outputs.status == 'ahead')
continue-on-error: true
if: success() || steps.fork-sync.outputs.status == 'uptodate' || steps.fork-sync.outputs.status == 'ahead'
with:
status: custom
fields: workflow
Expand All @@ -261,8 +264,8 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.slack-webhook-url }}
- uses: 8398a7/action-slack@v3
if: github.event_name != 'pull_request' && (failure() && steps.fork-sync.outputs.status != 'uptodate' && steps.fork-sync.outputs.status != 'ahead')
continue-on-error: true
if: failure() && steps.fork-sync.outputs.status != 'uptodate' && steps.fork-sync.outputs.status != 'ahead'
with:
status: custom
fields: workflow
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/merge-kube-state-metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' #@daily
pull_request:
paths:
- '.github/workflows/merge-flow.yaml'
- '.github/workflows/merge-kube-state-metrics.yaml'
push:
paths:
- '.github/workflows/merge-flow.yaml'
- '.github/workflows/merge-kube-state-metrics.yaml'

jobs:
kube-state-metrics-merge:
uses: rhobs/syncbot/.github/workflows/merge-flow.yaml@main
uses: ./.github/workflows/merge-flow.yaml
with:
upstream: kubernetes/kube-state-metrics
downstream: openshift/kube-state-metrics
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/merge-metrics-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@ on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' #@daily
pull_request:
paths:
- '.github/workflows/merge-flow.yaml'
- '.github/workflows/merge-metrics-server.yaml'
push:
paths:
- '.github/workflows/merge-flow.yaml'
- '.github/workflows/merge-metrics-server.yaml'

jobs:
metrics-server-merge:
uses: rhobs/syncbot/.github/workflows/merge-flow.yaml@main
uses: ./.github/workflows/merge-flow.yaml
with:
upstream: kubernetes-sigs/metrics-server
downstream: openshift/kubernetes-metrics-server
sandbox: rhobs/kubernetes-metrics-server
go-version: 1.20
go-version: "1.20"
restore-downstream: OWNERS charts/OWNERS
downstream-version-expression: |
sed -n -E 's/^.*newTag: *(v[0-9]+\.[0-9]+\.[0-9]+).*$/\1/p' https://raw.githubusercontent.com/openshift/kubernetes-metrics-server/master/manifests/release/kustomization.yaml
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/merge-node-exporter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' #@daily
pull_request:
paths:
- '.github/workflows/merge-flow.yaml'
- '.github/workflows/merge-node-exporter.yaml'
push:
paths:
- '.github/workflows/merge-flow.yaml'
- '.github/workflows/merge-node-exporter.yaml'
jobs:
node-exporter-merge:
uses: rhobs/syncbot/.github/workflows/merge-flow.yaml@main
uses: ./.github/workflows/merge-flow.yaml
with:
upstream: prometheus/node_exporter
downstream: openshift/node_exporter
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/merge-prom-label-proxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' #@daily
pull_request:
paths:
- '.github/workflows/merge-flow.yaml'
- '.github/workflows/merge-prom-label-proxy.yaml'
push:
paths:
- '.github/workflows/merge-flow.yaml'
- '.github/workflows/merge-prom-label-proxy.yaml'
jobs:
prom-label-proxy-merge:
uses: rhobs/syncbot/.github/workflows/merge-flow.yaml@main
uses: ./.github/workflows/merge-flow.yaml
with:
upstream: prometheus-community/prom-label-proxy
downstream: openshift/prom-label-proxy
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/merge-prometheus-adapter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' #@daily
pull_request:
paths:
- '.github/workflows/merge-flow.yaml'
- '.github/workflows/merge-prometheus-adapter.yaml'
push:
paths:
- '.github/workflows/merge-flow.yaml'
- '.github/workflows/merge-prometheus-adapter.yaml'
jobs:
prometheus-adapter-merge:
uses: rhobs/syncbot/.github/workflows/merge-flow.yaml@main
uses: ./.github/workflows/merge-flow.yaml
with:
upstream: kubernetes-sigs/prometheus-adapter
downstream: openshift/k8s-prometheus-adapter
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/merge-prometheus-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' #@daily
pull_request:
paths:
- '.github/workflows/merge-flow.yaml'
- '.github/workflows/merge-prometheus-operator.yaml'
push:
paths:
- '.github/workflows/merge-flow.yaml'
- '.github/workflows/merge-prometheus-operator.yaml'
jobs:
prometheus-operator-merge:
uses: rhobs/syncbot/.github/workflows/merge-flow.yaml@main
uses: ./.github/workflows/merge-flow.yaml
with:
upstream: prometheus-operator/prometheus-operator
downstream: openshift/prometheus-operator
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/merge-prometheus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' #@daily
pull_request:
paths:
- '.github/workflows/merge-flow.yaml'
- '.github/workflows/merge-prometheus.yaml'
push:
paths:
- '.github/workflows/merge-flow.yaml'
- '.github/workflows/merge-prometheus.yaml'
jobs:
prometheus-merge:
uses: rhobs/syncbot/.github/workflows/merge-flow.yaml@main
uses: ./.github/workflows/merge-flow.yaml
with:
upstream: prometheus/prometheus
downstream: openshift/prometheus
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/merge-thanos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' #@daily
pull_request:
paths:
- '.github/workflows/merge-flow.yaml'
- '.github/workflows/merge-thanos.yaml'
push:
paths:
- '.github/workflows/merge-flow.yaml'
- '.github/workflows/merge-thanos.yaml'
jobs:
thanos-merge:
uses: rhobs/syncbot/.github/workflows/merge-flow.yaml@main
uses: ./.github/workflows/merge-flow.yaml
with:
upstream: thanos-io/thanos
downstream: openshift/thanos
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-cmo-deps-versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- cron: '0 0 * * *' #@daily
jobs:
versions-update:
uses: rhobs/syncbot/.github/workflows/cmo-make-targets.yaml@main
uses: ./.github/workflows/cmo-make-targets.yaml
with:
go-version: "1.20"
make-targets: versions generate
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-cmo-jsonnet-deps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- cron: '0 0 * * 1' #@weekly
jobs:
jsonnet-update:
uses: rhobs/syncbot/.github/workflows/cmo-make-targets.yaml@main
uses: ./.github/workflows/cmo-make-targets.yaml
with:
go-version: "1.20"
make-targets: update generate
Expand Down

0 comments on commit f485482

Please sign in to comment.