Skip to content

Commit

Permalink
Merge pull request #90 from rexagod/ksm-no-version
Browse files Browse the repository at this point in the history
bugfix: support non-VERSION approach for KSM
  • Loading branch information
simonpasquier authored Jul 30, 2024
2 parents 8f258fb + 61b3b4b commit aadf1d4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
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 @@ on:
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 @@ -88,14 +88,14 @@ jobs:
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 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

0 comments on commit aadf1d4

Please sign in to comment.