Skip to content
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
23 changes: 23 additions & 0 deletions commands/update-ui/update-ui.cmd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "../../node_modules/command-bot/src/schema/schema.cmd.json",
"command": {
"description": "Update UI tests, e.g. after a rust toolchain upgrade, and commit them to your PR.",
"configuration": {
"gitlab": {
"job": {
"tags": ["linux-docker-vm-c2"],
"variables": {}
}
}
},
"presets": {
"substrate": {
"description": "Update substrate UI tests",
"repos": ["substrate"],
"args": {
"rust_version": { "label": "Rust version", "type_rule": "/^[0-9.]+$/", "example": "1.70" }
}
}
}
}
}
35 changes: 35 additions & 0 deletions commands/update-ui/update-ui.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

set -eu -o pipefail
shopt -s inherit_errexit

. "$(dirname "${BASH_SOURCE[0]}")/../utils.sh"
. "$(dirname "${BASH_SOURCE[0]}")/../cmd_runner.sh"

main() {
# setup.
cmd_runner_setup

rust_version="$1"
if [[ -z "${rust_version}" ]]; then
die "missing rust version argument"
fi

# This script uses rustup to install the required rust version.
# Doing that in CI feels rather ugly, but sadly there's currently no mechanism
# in command-bot to use a different CI image for individual jobs, so this is

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like a nice feature to have.

@mordamax currently we're using paritytech/ci-linux:production, as far as I understand.
But does anything stop us from allowing that to be configured in the command scripts?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry may be i don't get this question
isn't setting tag in .cmd.json linux-docker-vm-c2 to something else lets to change the image?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it changes the machine to execute the job on, not the image...

Copy link
Collaborator

@mordamax mordamax Jun 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea while i thought different machine would have different image
but yea, you're right, now i paid attention that we have this configured on the app level

process.env.GITLAB_JOB_IMAGE ??= "paritytech/ci-linux:production"

yea, technically abs possible to make it as part of .cmd.json, but would that be ok overall? i mean secure etc

cc @altaua @alvicsam

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that'd be useful, and no particular security concern. (For example, the CI image for normal CI jobs is configured in the .gitlab-ci.yml of the repo being tested; being able to configure it here in command-bot-scripts is no worse than that.)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea i can add it then to a .cmd.json config

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# the best we can do.
.maintain/update-rust-stable.sh "${rust_version}"

# commit.
git add .
git commit -m "${COMMIT_MESSAGE}"

# Push the results to the target branch
git remote add \
github \
"https://token:${GITHUB_TOKEN}@github.com/${GH_CONTRIBUTOR}/${GH_CONTRIBUTOR_REPO}.git"
git push github "HEAD:${GH_CONTRIBUTOR_BRANCH}"
}

main "$@"