Conversation
| environments: | ||
| - name: PATH |
There was a problem hiding this comment.
The shell script won't be able to use grep, head, awk or any other command if the PATH is not added.
when I add the following lines to the script:
which grep
which head
which awk
which test
echo $version
this is the output without PATH:
checkIfVersionDiffers
---------------------
The shell 🐚 command "bash .ci/scripts/test-version.sh 4.6.2" exited on error (exit code 1) with the following output:
----
----
command stderr output was:
----
----
=> expected condition result false, got false
this is the output with PATH:
checkIfVersionDiffers
---------------------
The shell 🐚 command "bash .ci/scripts/test-version.sh 4.6.2" exited on error (exit code 1) with the following output:
----
/usr/bin/grep
/usr/bin/head
/usr/bin/awk
/bin/test
4.6.2
----
command stderr output was:
----
----
=> expected condition result false, got false
There was a problem hiding this comment.
Uhm, I'm a bit confused, I have not seen that behaviour when using curl in the sources section through a script:
or a grep command in the target section:
There was a problem hiding this comment.
It works in my end:
$ gh pr checkout 186
$ vim .ci/bump-opbeans-ruby.yml
$ git --no-pager diff
diff --git a/.ci/bump-opbeans-ruby.yml b/.ci/bump-opbeans-ruby.yml
index 84cfd42..15cdefe 100644
--- a/.ci/bump-opbeans-ruby.yml
+++ b/.ci/bump-opbeans-ruby.yml
@@ -53,8 +53,6 @@ conditions:
sourceid: elastic-apm-agent-ruby
spec:
command: bash .ci/scripts/test-version.sh
- environments:
- - name: PATH
$ GIT_USER=foo GIT_EMAIL=bar GITHUB_TOKEN=$GITHUB_TOKEN updatecli diff --config .ci/bump-opbeans-ruby.yml
...
CONDITIONS:
===========
checkIfVersionDiffers
---------------------
The shell 🐚 command "/bin/sh /var/folders/hn/j6gds1qx1f5bysfn0qp0t03c0000gn/T/updatecli/bin/a6a5b89025ff47d8e91d16ce3dbd751bcbbd4c2b1c01716eeb6e5c5cc9b6bc63.sh" exited on error (exit code 1) with the following output:
----
----
command stderr output was:
----
----
shell command failed. Expected exit code 0 but got 1
=> expected condition result false, got false
✗ condition not met, skipping pipeline
=============================
REPORTS:
- Bump elastic-apm to latest version:
Source:
✔ [elastic-apm-agent-ruby] (kind: gittag)
Condition:
✗ [checkIfVersionDiffers] Check if installed version differs (kind: shell)
Target:
- [dockerfile-label-schema] Set org.label-schema.version in Dockerfile (kind: file)
- [dockerfile-opencontainers] Set org.opencontainers.image.version in Dockerfile (kind: file)
- [gem] Bump elastic-apm (kind: shell)
- [gemfile] Install new elastic-apm pip dependency version (kind: file)
Run Summary
===========
Pipeline(s) run:
* Changed: 0
* Failed: 0
* Skipped: 1
* Succeeded: 0
* Total: 1There was a problem hiding this comment.
In any case, I don't see this is a problem but the opposite, it might help when the environments are not configured
There was a problem hiding this comment.
That's interesting.
Due to the output not being generated when the PATH is not passed, I assumed it's not working.
But you are right, it seems to have the correct behaviour even without any output.
| kind: shell | ||
| sourceid: elastic-apm-agent-ruby | ||
| spec: | ||
| command: bash .ci/scripts/test-version.sh |
There was a problem hiding this comment.
NIT: if .ci/scripts/test-version.sh got execution permissions, and it uses the shebang I'd say bash is not required
because it has exection permissions and has a shebang already
Details
The workflow https://github.com/elastic/opbeans-ruby/actions/runs/4968635143 is failing with "nothing to commit"
Adding a
conditionshould stop the updatecli pipeline to continue if the given version is already installed.