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

chore: change auto-pr action to create proper PR body for renku pre-releases #3044

Merged
merged 8 commits into from May 2, 2023
Merged
20 changes: 19 additions & 1 deletion .github/workflows/auto-reqs-update-pr.yml
Expand Up @@ -19,10 +19,28 @@ jobs:
for pr in $other_prs ; do curl -s -H "Authorization: token $GITHUB_TOKEN" -X PATCH -d '{"state": "closed"}' ${renku_repo}/pulls/${pr} ; done
env:
GITHUB_TOKEN: ${{ secrets.RENKUBOT_GITHUB_TOKEN }}
- name: set PR body
id: set_pr_body
run: |
regex='renku-[a-z]+'
[[ ${GITHUB_REF} =~ $regex ]]
pr_repo=$BASH_REMATCH

pr_body="This is an automated pull request.\n\n/deploy"
Panaetius marked this conversation as resolved.
Show resolved Hide resolved

# get current cli version for core PRs and set PR body for tests to pass
if [ pr_repo == "renku-core" ]; then
regex='renku-core-([[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+)'
[[ ${GITHUB_REF} =~ $regex ]]
core_version=${BASH_REMATCH[1]}
current_version_maybe_rc=$(curl -s https://pypi.org/pypi/renku/json | jq -r ".releases | keys_unsorted | map(select( . | startswith(\"$core_version\"))) | sort_by(. | split(\"[.]|rc\";\"\") | map(tonumber))[-1]")
pr_body="$pr_body extra-values=global.renku.cli_version=$current_version_maybe_rc"
fi
echo "pr_body=$pr_body" >> "$GITHUB_OUTPUT"
- name: pull-request-action
uses: vsoch/pull-request-action@master
env:
GITHUB_TOKEN: ${{ secrets.RENKUBOT_GITHUB_TOKEN }}
BRANCH_PREFIX: "auto-update/"
PULL_REQUEST_BRANCH: "master"
PULL_REQUEST_BODY: "This is an automated pull request.\n\n/deploy"
PULL_REQUEST_BODY: ${{needs.set_pr_body.outputs.pr_body}}
Expand Up @@ -42,7 +42,7 @@ object CliVersion {

final case class ReleasedVersion(value: String) extends CliVersion
object ReleasedVersion {
private val validator = raw"\d+\.\d+\.\d+(\.post\d+)?(\.dev\d+)?"
private val validator = raw"\d+\.\d+\.\d+(rc\d+)?"

def get(value: String): Option[CliVersion] =
Option.when(value.trim matches validator)(new ReleasedVersion(value.trim))
Expand All @@ -57,7 +57,7 @@ object CliVersion {
}

object NonReleasedVersion {
private val validator = raw"\d+\.\d+\.\d+(?:(?:\-?rc\d+)?|(?:\.post\d+)?)\.dev\d+\+g([0-9a-f]{5,40})"
private val validator = raw"\d+\.\d+\.\d+((rc\d+)?|(?:\.post\d+)?)\.dev\d+\+g([0-9a-f]{5,40})"

def get(value: String): Option[CliVersion] =
Option.when(value.trim matches validator)(new NonReleasedVersion(value.trim))
Expand Down
4 changes: 4 additions & 0 deletions helm-chart/renku/templates/tests/test-renku.yaml
Expand Up @@ -27,6 +27,10 @@ spec:
value: '{{ .Values.tests.parameters.fullname }}'
- name: RENKU_TEST_PASSWORD
value: '{{ .Values.tests.parameters.password }}'
{{ if .Values.global.renku.cli_version }}
- name: RENKU_CLI_VERSION
value: '{{ .Values.global.renku.cli_version }}'
{{ end }}
{{ if .Values.tests.parameters.provider }}
- name: RENKU_TEST_PROVIDER
value: '{{ .Values.tests.parameters.provider }}'
Expand Down
3 changes: 3 additions & 0 deletions helm-chart/renku/values.yaml
Expand Up @@ -49,6 +49,9 @@ global:
## the UI) If not set explicitly the version will be picked up
## from the respective renku (sub)chart.
version: 0.4.0
## CLI Version to be used for project creation. if not set, the
## same version as core-svc is used.
# cli_version: 2.4.0
## Note that the graph will not turned on by default until renku 0.4.0
graph:
dbEventLog:
Expand Down