Skip to content

Commit

Permalink
Merge pull request #97 from jacobbaungard/acm-grafana
Browse files Browse the repository at this point in the history
Add ACM Grafana config
  • Loading branch information
jacobbaungard authored Sep 23, 2024
2 parents 970e68e + cac04e2 commit bad0dc8
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 8 deletions.
24 changes: 16 additions & 8 deletions .github/workflows/merge-acm-flow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ on:
required: false
default: ''
type: string
go-mod-tidy:
description: Run `go mod tidy` after a merge
required: false
default: true
type: boolean
secrets:
cloner-app-id:
description: Github ID of cloner app
Expand Down Expand Up @@ -82,9 +87,11 @@ jobs:
- name: Find github org name from repo name
id: org
run: |
echo "upstream=$(dirname ${{ inputs.upstream }})" >> $GITHUB_OUTPUT
echo "downstream=$(dirname ${{ inputs.downstream }})" >> $GITHUB_OUTPUT
echo "sandbox=$(dirname ${{ inputs.sandbox }})" >> $GITHUB_OUTPUT
{
echo "upstream=$(dirname ${{ inputs.upstream }})"
echo "downstream=$(dirname ${{ inputs.downstream }})"
echo "sandbox=$(dirname ${{ inputs.sandbox }})"
} >> "$GITHUB_OUTPUT"
DOWNSTREAM_VERSION=$(curl -sL "https://raw.githubusercontent.com/${{ inputs.downstream }}/${{ inputs.downstream-branch }}/VERSION")
if [[ "${DOWNSTREAM_VERSION}" =~ ^$|"404: Not Found" ]]; then
# Strip the trailing URL from the expression.
Expand All @@ -101,7 +108,7 @@ jobs:
exit 1
fi
fi
echo "downstream-version=${DOWNSTREAM_VERSION}" >> $GITHUB_OUTPUT
echo "downstream-version=${DOWNSTREAM_VERSION}" >> "$GITHUB_OUTPUT"
- uses: madhead/semver-utils@latest
id: version
with:
Expand All @@ -114,14 +121,14 @@ jobs:
SEMVER_RESULT="${{ steps.version.outputs.comparison-result }}"
echo "${{ inputs.downstream }}@${{ steps.org.outputs.downstream-version }} ${SEMVER_RESULT} ${{ inputs.upstream }}@${{ steps.upstream.outputs.release }}"
if [ "${SEMVER_RESULT}" == "<" ]; then
echo "status=outdated" >> $GITHUB_OUTPUT
echo "status=outdated" >> "$GITHUB_OUTPUT"
echo "::notice::downstream outdated"
elif [ "${SEMVER_RESULT}" == "=" ]; then
echo "status=uptodate" >> $GITHUB_OUTPUT
echo "status=uptodate" >> "$GITHUB_OUTPUT"
echo "::notice::downstream up-to-date"
exit 0
else
echo "status=ahead" >> $GITHUB_OUTPUT
echo "status=ahead" >> "$GITHUB_OUTPUT"
echo "::notice::downstream ahead"
exit 0
fi
Expand All @@ -139,7 +146,7 @@ jobs:
- name: Merge with upstream ${{ steps.upstream.outputs.release }} tag
id: merge
run: |
git merge -X theirs refs/tags/${{ steps.upstream.outputs.release }} --no-edit || echo 'MERGE_CONFLICT=true' >> $GITHUB_OUTPUT
git merge -X theirs refs/tags/${{ steps.upstream.outputs.release }} --no-edit || echo 'MERGE_CONFLICT=true' >> "$GITHUB_OUTPUT"
- name: Resolve conflict using upstream contents
if: ${{ steps.merge.outputs.MERGE_CONFLICT == 'true' && inputs.restore-upstream != ''}}
run: |
Expand Down Expand Up @@ -186,6 +193,7 @@ jobs:
with:
node-version: ${{ inputs.node-version }}
- name: go mod tidy + vendor
if: ${{ inputs.go-mod-tidy }}
run: |
go mod tidy
git add go.mod go.sum
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/merge-acm-grafana.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: ACM Grafana merger

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 1' #@weekly
pull_request:
paths:
- '.github/workflows/merge-acm-flow.yaml'
- '.github/workflows/merge-acm-grafana.yaml'
push:
paths:
- '.github/workflows/merge-acm-flow.yaml'
- '.github/workflows/merge-acm-grafana.yaml'
jobs:
grafana-merge:
uses: ./.github/workflows/merge-acm-flow.yaml
with:
upstream: grafana/grafana
downstream: stolostron/grafana
sandbox: rhobs/acm-grafana
go-version: "1.22"
node-version: "20"
go-mod-tidy: false
restore-downstream: >-
OWNERS
restore-upstream: >-
.drone.yml
CHANGELOG.md
docs
go.mod
go.sum
go.work
go.work.sum
pkg
lerna.json
package.json
packages
public/app/
yarn.lock
assets-cmd: |
# get rid of old assets as new filenames are generated
rm -rf ./public/build/
# generate nodejs files, using docker since it appears to be problematic doing
# it directly in the github action runner.
docker build --target js-builder -t grafana-js-build .
docker create --name grafana-jsbuild grafana-js-build:latest
docker cp grafana-jsbuild:/tmp/grafana/public/build ./public/
docker rm grafana-jsbuild
# Generate go files with wire
go mod download
go run ./pkg/build/wire/cmd/wire/main.go gen -tags oss ./pkg/server
# Commit assets
git add pkg/server/wire_gen.go ./public/build ./public/app/plugins/datasource/*/dist/*
git diff --cached --exit-code || git commit -s -m "[bot] assets: generate"
downstream-version-expression: |
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
secrets:
pr-app-id: ${{ secrets.ACM_APP_ID }}
pr-app-private-key: ${{ secrets.ACM_APP_PRIVATE_KEY }}
cloner-app-id: ${{ secrets.ACM_CLONER_APP_ID }}
cloner-app-private-key: ${{ secrets.ACM_CLONER_APP_PRIVATE_KEY }}
slack-webhook-url: ${{ secrets.ACM_SLACK_WEBHOOK_URL }}

0 comments on commit bad0dc8

Please sign in to comment.