Skip to content

Commit bad0dc8

Browse files
Merge pull request #97 from jacobbaungard/acm-grafana
Add ACM Grafana config
2 parents 970e68e + cac04e2 commit bad0dc8

File tree

2 files changed

+82
-8
lines changed

2 files changed

+82
-8
lines changed

.github/workflows/merge-acm-flow.yaml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ on:
4848
required: false
4949
default: ''
5050
type: string
51+
go-mod-tidy:
52+
description: Run `go mod tidy` after a merge
53+
required: false
54+
default: true
55+
type: boolean
5156
secrets:
5257
cloner-app-id:
5358
description: Github ID of cloner app
@@ -82,9 +87,11 @@ jobs:
8287
- name: Find github org name from repo name
8388
id: org
8489
run: |
85-
echo "upstream=$(dirname ${{ inputs.upstream }})" >> $GITHUB_OUTPUT
86-
echo "downstream=$(dirname ${{ inputs.downstream }})" >> $GITHUB_OUTPUT
87-
echo "sandbox=$(dirname ${{ inputs.sandbox }})" >> $GITHUB_OUTPUT
90+
{
91+
echo "upstream=$(dirname ${{ inputs.upstream }})"
92+
echo "downstream=$(dirname ${{ inputs.downstream }})"
93+
echo "sandbox=$(dirname ${{ inputs.sandbox }})"
94+
} >> "$GITHUB_OUTPUT"
8895
DOWNSTREAM_VERSION=$(curl -sL "https://raw.githubusercontent.com/${{ inputs.downstream }}/${{ inputs.downstream-branch }}/VERSION")
8996
if [[ "${DOWNSTREAM_VERSION}" =~ ^$|"404: Not Found" ]]; then
9097
# Strip the trailing URL from the expression.
@@ -101,7 +108,7 @@ jobs:
101108
exit 1
102109
fi
103110
fi
104-
echo "downstream-version=${DOWNSTREAM_VERSION}" >> $GITHUB_OUTPUT
111+
echo "downstream-version=${DOWNSTREAM_VERSION}" >> "$GITHUB_OUTPUT"
105112
- uses: madhead/semver-utils@latest
106113
id: version
107114
with:
@@ -114,14 +121,14 @@ jobs:
114121
SEMVER_RESULT="${{ steps.version.outputs.comparison-result }}"
115122
echo "${{ inputs.downstream }}@${{ steps.org.outputs.downstream-version }} ${SEMVER_RESULT} ${{ inputs.upstream }}@${{ steps.upstream.outputs.release }}"
116123
if [ "${SEMVER_RESULT}" == "<" ]; then
117-
echo "status=outdated" >> $GITHUB_OUTPUT
124+
echo "status=outdated" >> "$GITHUB_OUTPUT"
118125
echo "::notice::downstream outdated"
119126
elif [ "${SEMVER_RESULT}" == "=" ]; then
120-
echo "status=uptodate" >> $GITHUB_OUTPUT
127+
echo "status=uptodate" >> "$GITHUB_OUTPUT"
121128
echo "::notice::downstream up-to-date"
122129
exit 0
123130
else
124-
echo "status=ahead" >> $GITHUB_OUTPUT
131+
echo "status=ahead" >> "$GITHUB_OUTPUT"
125132
echo "::notice::downstream ahead"
126133
exit 0
127134
fi
@@ -139,7 +146,7 @@ jobs:
139146
- name: Merge with upstream ${{ steps.upstream.outputs.release }} tag
140147
id: merge
141148
run: |
142-
git merge -X theirs refs/tags/${{ steps.upstream.outputs.release }} --no-edit || echo 'MERGE_CONFLICT=true' >> $GITHUB_OUTPUT
149+
git merge -X theirs refs/tags/${{ steps.upstream.outputs.release }} --no-edit || echo 'MERGE_CONFLICT=true' >> "$GITHUB_OUTPUT"
143150
- name: Resolve conflict using upstream contents
144151
if: ${{ steps.merge.outputs.MERGE_CONFLICT == 'true' && inputs.restore-upstream != ''}}
145152
run: |
@@ -186,6 +193,7 @@ jobs:
186193
with:
187194
node-version: ${{ inputs.node-version }}
188195
- name: go mod tidy + vendor
196+
if: ${{ inputs.go-mod-tidy }}
189197
run: |
190198
go mod tidy
191199
git add go.mod go.sum
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: ACM Grafana merger
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 0 * * 1' #@weekly
7+
pull_request:
8+
paths:
9+
- '.github/workflows/merge-acm-flow.yaml'
10+
- '.github/workflows/merge-acm-grafana.yaml'
11+
push:
12+
paths:
13+
- '.github/workflows/merge-acm-flow.yaml'
14+
- '.github/workflows/merge-acm-grafana.yaml'
15+
jobs:
16+
grafana-merge:
17+
uses: ./.github/workflows/merge-acm-flow.yaml
18+
with:
19+
upstream: grafana/grafana
20+
downstream: stolostron/grafana
21+
sandbox: rhobs/acm-grafana
22+
go-version: "1.22"
23+
node-version: "20"
24+
go-mod-tidy: false
25+
restore-downstream: >-
26+
OWNERS
27+
restore-upstream: >-
28+
.drone.yml
29+
CHANGELOG.md
30+
docs
31+
go.mod
32+
go.sum
33+
go.work
34+
go.work.sum
35+
pkg
36+
lerna.json
37+
package.json
38+
packages
39+
public/app/
40+
yarn.lock
41+
assets-cmd: |
42+
# get rid of old assets as new filenames are generated
43+
rm -rf ./public/build/
44+
45+
# generate nodejs files, using docker since it appears to be problematic doing
46+
# it directly in the github action runner.
47+
docker build --target js-builder -t grafana-js-build .
48+
docker create --name grafana-jsbuild grafana-js-build:latest
49+
docker cp grafana-jsbuild:/tmp/grafana/public/build ./public/
50+
docker rm grafana-jsbuild
51+
52+
# Generate go files with wire
53+
go mod download
54+
go run ./pkg/build/wire/cmd/wire/main.go gen -tags oss ./pkg/server
55+
56+
# Commit assets
57+
git add pkg/server/wire_gen.go ./public/build ./public/app/plugins/datasource/*/dist/*
58+
git diff --cached --exit-code || git commit -s -m "[bot] assets: generate"
59+
downstream-version-expression: |
60+
sed -n -E 's/^.*\"version\": *\"([0-9]+\.[0-9]+\.[0-9]+)\".*$/v\1/p' https://raw.githubusercontent.com/stolostron/grafana/release-2.12/package.json
61+
secrets:
62+
pr-app-id: ${{ secrets.ACM_APP_ID }}
63+
pr-app-private-key: ${{ secrets.ACM_APP_PRIVATE_KEY }}
64+
cloner-app-id: ${{ secrets.ACM_CLONER_APP_ID }}
65+
cloner-app-private-key: ${{ secrets.ACM_CLONER_APP_PRIVATE_KEY }}
66+
slack-webhook-url: ${{ secrets.ACM_SLACK_WEBHOOK_URL }}

0 commit comments

Comments
 (0)