Skip to content

Commit

Permalink
ci: Set default to fix 'unbound variable' error on main (#4916)
Browse files Browse the repository at this point in the history
## Which problem is this PR solving?
Build failed on `main`:
```
scripts/build-all-in-one-image.sh: line 5: $1: unbound variable
```

## Description of the changes
- Use default value for `$1` var

## How was this change tested?
```shell
$ bash scripts/build-all-in-one-image.sh
+ arg1=not-pr
+ [[ not-pr == \p\r\-\o\n\l\y ]]
+ is_pull_request=false
+ BINARY=all-in-one
++ go env GOARCH
+ GOARCH=arm64
+ repo=jaegertracing/all-in-one
++ cat jaeger-ui/.nvmrc
+ expected_version=v18
++ node --version
scripts/build-all-in-one-image.sh: line 23: node: command not found
+ version=
```
fails much later (as expected)

Signed-off-by: Yuri Shkuro <github@ysh.us>
  • Loading branch information
yurishkuro authored Nov 3, 2023
1 parent 7ff9c3a commit 5e91855
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/build-all-in-one-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

set -exu

if [[ "$1" == "pr-only" ]]; then
arg1=${1:-'not-pr'}
if [[ "$arg1" == "pr-only" ]]; then
is_pull_request=true
else
is_pull_request=false
Expand Down

0 comments on commit 5e91855

Please sign in to comment.