Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: support non-VERSION approach for KSM #90

Merged
merged 2 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/actions-ci-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: reviewdog/action-actionlint@v1
8 changes: 4 additions & 4 deletions .github/workflows/merge-flow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
default: ''
type: string
downstream-version-expression:
description: Expression to extract downstream version from downstream repo.
description: Expression to extract downstream version from downstream repo. Follows the https://www.npmjs.com/package/semver spec.
required: false
default: ''
type: string
Expand Down Expand Up @@ -81,21 +81,21 @@
echo "release=${UPSTREAM_VERSION}" >> "$GITHUB_OUTPUT"
- name: Find github org name from repo name
id: org
run: |

Check failure on line 84 in .github/workflows/merge-flow.yaml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2129:style:1:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects [shellcheck] Raw Output: .github/workflows/merge-flow.yaml:84:9: shellcheck reported issue in this script: SC2129:style:1:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects [shellcheck]

Check failure on line 84 in .github/workflows/merge-flow.yaml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2086:info:1:54: Double quote to prevent globbing and word splitting [shellcheck] Raw Output: .github/workflows/merge-flow.yaml:84:9: shellcheck reported issue in this script: SC2086:info:1:54: Double quote to prevent globbing and word splitting [shellcheck]

Check failure on line 84 in .github/workflows/merge-flow.yaml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2086:info:2:58: Double quote to prevent globbing and word splitting [shellcheck] Raw Output: .github/workflows/merge-flow.yaml:84:9: shellcheck reported issue in this script: SC2086:info:2:58: Double quote to prevent globbing and word splitting [shellcheck]

Check failure on line 84 in .github/workflows/merge-flow.yaml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2086:info:3:52: Double quote to prevent globbing and word splitting [shellcheck] Raw Output: .github/workflows/merge-flow.yaml:84:9: shellcheck reported issue in this script: SC2086:info:3:52: Double quote to prevent globbing and word splitting [shellcheck]

Check failure on line 84 in .github/workflows/merge-flow.yaml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2086:info:20:52: Double quote to prevent globbing and word splitting [shellcheck] Raw Output: .github/workflows/merge-flow.yaml:84:9: shellcheck reported issue in this script: SC2086:info:20:52: Double quote to prevent globbing and word splitting [shellcheck]
echo "upstream=$(dirname ${{ inputs.upstream }})" >> $GITHUB_OUTPUT
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}" =~ ^$|"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[^ ]*$//')
DOWNSTREAM_VERSION_EXPRESSION=$(echo "${{ inputs.downstream-version-expression }}" | sed -e 's/\(http[^ ]*\).*$/\1/' -e 's/http[^ ]*$//')
# Strip the leading sed command from the expression.
DOWNSTREAM_VERSION_URL=$(echo "${{ inputs.downstream-version-expression }}" | sed -n 's/^.*\(http[^ ]*\).*$/\1/p')
if [ "${DOWNSTREAM_VERSION_SED}" == "" ] || [ "${DOWNSTREAM_VERSION_URL}" == "" ]; then
if [ "${DOWNSTREAM_VERSION_EXPRESSION}" == "" ] || [ "${DOWNSTREAM_VERSION_URL}" == "" ]; then
echo "::error::downstream-version-expression is invalid"
exit 1
fi
DOWNSTREAM_VERSION=$(curl --silent "${DOWNSTREAM_VERSION_URL}" | eval "${DOWNSTREAM_VERSION_SED}")
DOWNSTREAM_VERSION=$(curl --silent "${DOWNSTREAM_VERSION_URL}" | eval "${DOWNSTREAM_VERSION_EXPRESSION}")
if ! [[ "${DOWNSTREAM_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::downstream-version-expression is invalid"
exit 1
Expand All @@ -110,7 +110,7 @@
lenient: false # fail if either of the versions cannot be parsed
- name: Check openshift fork status
id: fork-sync
run: |

Check failure on line 113 in .github/workflows/merge-flow.yaml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2086:info:4:29: Double quote to prevent globbing and word splitting [shellcheck] Raw Output: .github/workflows/merge-flow.yaml:113:9: shellcheck reported issue in this script: SC2086:info:4:29: Double quote to prevent globbing and word splitting [shellcheck]

Check failure on line 113 in .github/workflows/merge-flow.yaml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2086:info:7:29: Double quote to prevent globbing and word splitting [shellcheck] Raw Output: .github/workflows/merge-flow.yaml:113:9: shellcheck reported issue in this script: SC2086:info:7:29: Double quote to prevent globbing and word splitting [shellcheck]

Check failure on line 113 in .github/workflows/merge-flow.yaml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2086:info:11:26: Double quote to prevent globbing and word splitting [shellcheck] Raw Output: .github/workflows/merge-flow.yaml:113:9: shellcheck reported issue in this script: SC2086:info:11:26: Double quote to prevent globbing and word splitting [shellcheck]
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
Expand All @@ -125,7 +125,7 @@
echo "::notice::downstream ahead"
exit 0
fi
- uses: actions/checkout@v2

Check failure on line 128 in .github/workflows/merge-flow.yaml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue [action] Raw Output: .github/workflows/merge-flow.yaml:128:15: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue [action]
with:
repository: ${{ inputs.downstream }}
fetch-depth: 0
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/merge-kube-state-metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ jobs:
upstream: kubernetes/kube-state-metrics
downstream: openshift/kube-state-metrics
sandbox: rhobs/kube-state-metrics
go-version: "1.20"
restore-upstream: CHANGELOG.md VERSION
go-version: "1.22"
restore-upstream: |
CHANGELOG.md .github/ Dockerfile docs/ go.mod
restore-downstream: OWNERS
downstream-version-expression: |
sed -n -E 's/^version: "*([0-9]+\.[0-9]+\.[0-9]+)"$/v\1/p' https://raw.githubusercontent.com/openshift/kube-state-metrics/main/data.yaml
secrets:
pr-app-id: ${{ secrets.APP_ID }}
pr-app-private-key: ${{ secrets.APP_PRIVATE_KEY }}
Expand Down
Loading