Skip to content

Commit

Permalink
fixup! address the missing upstream VERSION case
Browse files Browse the repository at this point in the history
  • Loading branch information
rexagod committed Nov 12, 2024
1 parent 9ef33c8 commit c71a859
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 29 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/acm-konflux-update-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Find github org name from repo name
id: org
run: |
echo "downstream=$(dirname ${{ matrix.repo }})" >> $GITHUB_OUTPUT
echo "downstream=$(dirname ${{ matrix.repo }})" >> "$GITHUB_OUTPUT"
- name: Get auth token to list pull request for ${{ matrix.repo }}
if: github.event_name != 'pull_request'
id: pr
Expand All @@ -56,17 +56,17 @@ jobs:
PR_LIST=$(gh pr list --repo ${{ matrix.repo }} --state open --json title)
KONFLUX_PR=$(echo "$PR_LIST" | jq '.[] | select(.title | ascii_downcase | contains("konflux"))')
if [ -n "$KONFLUX_PR" ]; then
echo "konflux_pr_exists=1" >> $GITHUB_OUTPUT
echo "konflux_pr_exists=1" >> "$GITHUB_OUTPUT"
else
echo "konflux_pr_exists=0" >> $GITHUB_OUTPUT
echo "konflux_pr_exists=0" >> "$GITHUB_OUTPUT"
fi
env:
GH_TOKEN: ${{ steps.pr.outputs.token }}
- name: Compose Slack message
id: slack-message
run: |
if [ "${{ steps.check-prs.outputs.konflux_pr_exists }}" == "1" ]; then
echo "message=Unmerged Konflux PRs are present in https://github.com/${{ matrix.repo }}" >> $GITHUB_OUTPUT
echo "message=Unmerged Konflux PRs are present in https://github.com/${{ matrix.repo }}" >> "$GITHUB_OUTPUT"
fi
- name: Send Slack notification
uses: 8398a7/action-slack@v3
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/cmo-make-targets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ jobs:
execute-make-targets:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: openshift/cluster-monitoring-operator
ref: master
- uses: actions/setup-go@v2
- uses: actions/setup-go@v5
with:
go-version: ${{ inputs.go-version }}
- name: Execute make targets - ${{ inputs.make-targets }}
run: make ${{ inputs.make-targets }}
- name: Ignore if change is only in jsonnetfile.lock.json
run: |
# Reset jsonnetfile.lock.json if no dependencies were updated
changedFiles=$(git diff --name-only | grep -v 'jsonnetfile.lock.json' | wc -l)
changedFiles=$(git diff --name-only | grep -cv 'jsonnetfile.lock.json')
if [[ "$changedFiles" -eq 0 ]]; then
git checkout -- jsonnet/jsonnetfile.lock.json;
fi
Expand All @@ -74,7 +74,7 @@ jobs:
- name: Find branch name
id: branch
run: |
echo "sandbox=$(echo ${{ inputs.make-targets }} | sed 's/ /-/g')" >> $GITHUB_OUTPUT
echo "sandbox=$(echo ${{ inputs.make-targets }} | sed 's/ /-/g')" >> "$GITHUB_OUTPUT"
- name: Create Pull Request
id: create-pr
uses: rhobs/create-pull-request@v3
Expand All @@ -94,9 +94,9 @@ jobs:
id: slack-message
run: |
if [ "${{ steps.create-pr.outputs.pull-request-url }}" == "" ]; then
echo "message=No changes detected." >> $GITHUB_OUTPUT
echo "message=No changes detected." >> "$GITHUB_OUTPUT"
else
echo "message=PR ${{ steps.create-pr.outputs.pull-request-url }} has been ${{ steps.create-pr.outputs.pull-request-operation || 'updated' }}." >> $GITHUB_OUTPUT
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
continue-on-error: true
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/merge-acm-flow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,12 @@ jobs:
if [ "${{ steps.create-pr.outcome }}" != "success" ]; then
echo "${{ steps.create-pr.outcome }}"
PR_URL=$(gh pr list --json url --jq '.[0].url' --repo ${{ inputs.downstream }} --state open --head automated-updates-acm-${{ inputs.downstream-branch }})
if [ ! -z "$PR_URL" ]; then
echo "pr_exists=1" >> $GITHUB_OUTPUT
echo "pr_url=$PR_URL" >> $GITHUB_OUTPUT
if [ -n "$PR_URL" ]; then
echo "pr_exists=1" >> "$GITHUB_OUTPUT"
echo "pr_url=$PR_URL" >> "$GITHUB_OUTPUT"
echo "PR exists >> $PR_URL"
else
echo "pr_exists=0" >> $GITHUB_OUTPUT
echo "pr_exists=0" >> "$GITHUB_OUTPUT"
fi
fi
- name: Compose slack message body
Expand All @@ -283,9 +283,9 @@ jobs:
PR_URL="${{ steps.create-pr.outputs.pull-request-url }}"
fi
if [ "${{ steps.fork-sync.outputs.status }}" == "uptodate" ] || [ "${{ steps.fork-sync.outputs.status }}" == "ahead" ]; then
echo "message=${{ inputs.downstream }} is already ${{ steps.fork-sync.outputs.status }} with tag ${{ steps.org.outputs.downstream-version }}." >> $GITHUB_OUTPUT
echo "message=${{ inputs.downstream }} is already ${{ steps.fork-sync.outputs.status }} with tag ${{ steps.org.outputs.downstream-version }}." >> "$GITHUB_OUTPUT"
else
echo "message=PR $PR_URL has been ${{ steps.create-pr.outputs.pull-request-operation || 'updated' }}." >> $GITHUB_OUTPUT
echo "message=PR $PR_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' || steps.pr-exists.outputs.pr_exists == '1')
Expand Down
28 changes: 15 additions & 13 deletions .github/workflows/merge-flow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,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 +103,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,18 +116,18 @@ 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
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
repository: ${{ inputs.downstream }}
fetch-depth: 0
Expand All @@ -140,7 +142,7 @@ jobs:
- name: Merge with upstream ${{ steps.upstream.outputs.release }} tag
id: merge
run: |
git merge refs/tags/${{ steps.upstream.outputs.release }} --no-edit || echo 'MERGE_CONFLICT=true' >> $GITHUB_OUTPUT
git merge 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 @@ -178,10 +180,10 @@ jobs:
echo "$version_from_tag" > VERSION
git add VERSION
git diff --cached --exit-code || git commit -s -m "[bot] add VERSION file with ${version_from_tag}"
- uses: actions/setup-go@v2
- uses: actions/setup-go@v5
with:
go-version: ${{ inputs.go-version }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
- name: Remove dependabot configuration
Expand Down Expand Up @@ -264,9 +266,9 @@ jobs:
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
echo "message=${{ inputs.downstream }} is already ${{ steps.fork-sync.outputs.status }} with tag ${{ steps.org.outputs.downstream-version }}." >> $GITHUB_OUTPUT
echo "message=${{ inputs.downstream }} is already ${{ steps.fork-sync.outputs.status }} with tag ${{ steps.org.outputs.downstream-version }}." >> "$GITHUB_OUTPUT"
else
echo "message=PR ${{ steps.create-pr.outputs.pull-request-url }} has been ${{ steps.create-pr.outputs.pull-request-operation || 'updated' }}." >> $GITHUB_OUTPUT
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')
Expand Down

0 comments on commit c71a859

Please sign in to comment.