Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use shell if in build command #256

Closed
radtriste opened this issue Jun 8, 2022 · 1 comment · Fixed by #257 or apache/incubator-kie-kogito-pipelines#496
Closed

Cannot use shell if in build command #256

radtriste opened this issue Jun 8, 2022 · 1 comment · Fixed by #257 or apache/incubator-kie-kogito-pipelines#496

Comments

@radtriste
Copy link

Pull request config example:

version: "2.1"

dependencies:
  - project: kiegroup/drools

build:
  - project: kiegroup/drools
    build-command:
      current: |
        if [ "${{ env.DISABLE_ANYTHING }}" != 'true' ]; then mvn -f drools/pom.xml clean install -Dfull ${{ env.BUILD_MVN_OPTS }} ${{ env.BUILD_MVN_OPTS_CURRENT }} ${{ env.DROOLS_BUILD_MVN_OPTS }}; fi
      upstream: mvn clean install -Dquickly ${{ env.BUILD_MVN_OPTS }} ${{ env.BUILD_MVN_OPTS_UPSTREAM }} ${{ env.DROOLS_BUILD_MVN_OPTS_UPSTREAM }}
    clone:
      - drools

Execute this command:

$ build-chain-action -df ./pull-request-config.yaml build pr -url https://github.com/kiegroup/kogito-runtimes/pull/2253 -sp kiegroup/drools

You will get this error:

[ERROR]  [kiegroup/drools] error executing command: 'if [ "true" != 'true' ]; then mvn -f drools/pom.xml clean install -Dfull   ; fi -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B'. Message: Error: Unable to locate executable file: if. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.
[ERROR]  Command executions have failed, please review latest execution Error: [kiegroup/drools] error executing command: 'if [ "true" != 'true' ]; then mvn -f drools/pom.xml clean install -Dfull   ; fi -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B'. Message: Error: Unable to locate executable file: if. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.

Looks like similar to actions/toolkit#461 with @action/exec command execution

@Ginxo
Copy link
Contributor

Ginxo commented Jun 9, 2022

the problem is here https://github.com/actions/toolkit/blob/b5f31bb5a25d129441c294fc81ba7f92f3e978ba/packages/exec/src/exec.ts#L27
the actions/exec considers the first word of the command is the tool to be used. Trying to figure out what's the best approach to handle/execute commands

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants