Add --version option to step-runner binary, and set a better version.

Currently when building a step-runner binary we set the its version to the SHA1 of the HEAD commit. This is not very useful, but since there was no way to show the binary's version it didn't matter much. This MR addressed both of these.

First we add a top-level --version flag to the step-runner binary:

./step-runner
Step Runner executes a series of CI steps

Usage:
  step-runner [command]

Available Commands:
  bootstrap   Copy the step-runner binary to the destination path
  ci          Run steps in a CI environment variable STEPS
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  proxy       Tunnel gRPC requests/responses from stdin/stdout to the service listening on a local socket
  run         Run a step locally
  serve       Start the step-runner gRPC service

Flags:
  -h, --help      help for step-runner
  -v, --version   version for step-runner

Use "step-runner [command] --help" for more information about a command.

Second, we add the actual project version to the step-runner binary instead of the HEAD commit SHA1. The script used to compute the version is inspired (stolen) from the runner project. Because our build procedure differs from runner's, substantial modification of the script was required. Specifically, because our release simply promotes builds made in the main branch instead of building fresh new binaries, we have to use a valid release semver (i.e. no release-candidate, build or pipeline suffix) in the main build. In MR and other branches release/build info in the semver is OK. Rather than add a VERSION file, I've used the "latest version from the CHANGELOG, which is in fact the "next" release version.

Edited by Axel von Bertoldi

Merge request reports

Loading