Commit Graph

7 Commits

Author SHA1 Message Date
Joakim Roubert 8d19b4055b
Improve shellscript portability by using /bin/env (#4628)
Using `/bin/env` increases portability for the shell scripts (and often using `/bin/env` is requested by e.g. Mac users). This would also facilitate testing scripts with different Bash versions via the Bash containers, as they have bash in `/usr/local` and not `/bin`. Using `/bin/env`, there is no need to change the script when testing. (I assume the latter was behind c301ea214b (diff-ecec5e3a811f60bc2739019004fa35b0), which would not happen using `/bin/env`.)

Signed-off-by: Joakim Roubert <joakimr@axis.com>
2020-06-19 15:49:29 -04:00
Joakim Roubert 5c104ebec6
Run shellcheck for all shell scripts in repository (#4441)
* Run shellcheck for all shell scripts in repository

Update the shellcheck command in static_checks.yml to not only scan the
contents of ./bin, but search for all files with mimetype
text/x-shellscript and feed them to shellcheck.

Certainly, this is a tad more time consuming than just scanning one
directory, but still a quite fast thing to do while it prevents any
new scripts to fly under the radar.

(Also, there is no need to exclude *.nuspec or *.ps1 from the find
command as they do not have the text/x-shellscript mimetype.)

Change-Id: I7433d231e8a315df65c03ee8765914e782057343
Signed-off-by: Joakim Roubert <joakimr@axis.com>

* Updates after review comment

Move shellcheck of all scripts to own script that is then called by
static_checks.yml as suggested by @kleimkuhler.
Also updated sources for helm-build and kind-load so that the
new shellcheck-all script can be called from any directory.

Change-Id: I9e82230459cb843c4143ec979c93060f424baed8
Signed-off-by: Joakim Roubert <joakim.roubert@axis.com>
2020-05-20 14:08:45 -07:00
Kevin Leimkuhler 29db6c12a1
Fix script argument regex (#4188)
Currently the release tag regex matches against arguments that have `edge` or
`stable` as a substring.

It should only match against arguments that are either `edge` or `stable`.

For example, the graceful error handling is not triggered for the following:
```
❯ bin/create-release-tag edge-20.3.3
bin/create-release-tag: line 92: release_tag: unbound variable
```

This PR fixes the regex so that the above results in graceful error handling.

```
❯ bin/create-release-tag edge-20.3.3
Error: valid release channels: edge, stable
Usage:
    bin/create-release-tag edge
    bin/create-release-tag stable 2.4.8
```
2020-03-19 15:13:17 -07:00
Kevin Leimkuhler d69445db55
Improve release tag script (#4144)
## Motivation

Closes #4140

Automatically create new edge release tag:
```
❯ bin/create-release-tag edge
edge-20.3.2 tag created and signed.

tag: edge-20.3.2

To push tag, run:
    git push origin edge-20.3.2
```

Validate new stable release tag:
```
❯ bin/create-release-tag stable 2.7.1
stable-2.7.1 tag created and signed.

tag: stable-2.7.1

To push tag, run:
    git push origin stable-2.7.1
```

## Solution

The release tag script now takes a release channel argument. If the release
channel argument is `stable`, a second argument is required for the version.

If the release channel is `edge`, the script gets the current edge version and
creates a new edge version with the current year: `YY`, month: `MM`, and
increments the current month minor if it is not a new month.

If the release channel is `stable`, the script will only validate the version.

Example error cases:

```
❯ bin/create-release-tag
Error: create-release-tag accepts 1 or 2 arguments
Usage:
    create-release-tag edge
    create-release-tag stable x.x.x
```

```
❯ bin/create-release-tag foo
Error: valid release channels: edge, stable
Usage:
    bin/create-release-tag edge
    bin/create-release-tag stable 2.4.8
```

```
❯ bin/create-release-tag edge 2.7.1
Error: accepts 1 argument
Usage:
    bin/create-release-tag edge
```

```
❯ bin/create-release-tag stable
Error: accepts 2 arguments
Usage:
    bin/create-release-tag stable 2.4.8
```

```
❯ bin/create-release-tag stable 2.7
Error: version reference incorrect
Usage:
    bin/create-release-tag stable 2.4.8
```

```
❯ bin/create-release-tag stable 2.7.1.1
Error: version reference incorrect
Usage:
    bin/create-release-tag stable 2.4.8
```
2020-03-10 10:03:46 -07:00
Alejandro Pedraza 578a2d1960
CI: Adjustments to the release job (#4129)
Extracted the logic to pull the latest release notes, out of
`bin/create-release-tag` into `bin/_release.sh` so that it can be reused
in the `release.yml` workflow, which needs to use that inside
`gh_release` when creating the github release in order to have prettier
markup release notes instead of a plaintext message pulled out of the tag
message.
The new extracted function also receives an optional argument with the
name of the file to put the release notes into, because the `body_path`
parameter in `softprops/action-gh-release` doesn't work with dynamic
vars.

Finally, now the `website_publish` job will only launch until the `gh_release`
has succeeded.
2020-03-05 09:03:30 -05:00
Kevin Leimkuhler e37cb3b932
Add success message for tag script (#4111)
This adds a message after running the `create-release-script` that I intended to
add as part of the initial PR. Example output:

```
❯ bin/create-release-tag $TAG tag created and signed.

tag: edge-93.1.1

To push tag, run:
    git push origin edge-93.1.1
```
2020-02-27 10:03:41 -08:00
Kevin Leimkuhler 4aac6445c4
Add script to create release tag (#4091)
## Motivation

Creating a release tag is a manual process that is prone to error by the
release responsible member.

Additionally, the automated release project will require that a message is
included that is a copy of the recent `CHANGES.md` changes.

These steps can be scripted so that the member will just need to run a release
script.

## Solution

A `bin/create-release-tag` script will:
- Take a `$TAG` argument (maybe can remove this in the future) to use as the
  tag name
- Pull out the top section of `CHANGES.md` to use as the commit message
- Create the a tag with `$TAG` name and release changes as the message

## Example

```
$ TAG="edge-20.2.3"
$ bin/create-release-tag $TAG
$ git push $TAG
```

Signed-off-by: Kevin Leimkuhler <kevin@kleimkuhler.com>
2020-02-22 16:30:17 -08:00