Greetings
The sh file/command exists in the folder/volume. But even doing several tests returns me "unable to locate command"
like:
RUN mkdir -p /var/scripts
WORKDIR /var/scripts
COPY ["redeploy.sh", "gateway.json", "/var/scripts/"]
RUN chmod +x /var/scripts
gateway.json redeploy.sh
/var/scripts # cat gateway.json
[
{
"id": "redeploy-webhook",
"execute-command": "/var/scripts/redeploy.sh",
"command-working-directory": "/usr/local/bin/webhook"
}
]
/var/scripts # cat /var/scripts/redeploy.sh
#!/bin/bash
echo "Script Iniciado"
cd /rancherCLI/rancher-v0.6.7
export RANCHER_URL=http://192.168.99.199:8080
export RANCHER_ACCESS_KEY=$ACkEY
export RANCHER_SECRET_KEY=$SECRETK
export RANCHER_ENVIRONMENT=$ENV
export RANCHER_CLIENT_DEBUG=true
echo "rancherCLI pronto"
./rancher -v
./rancher restart G-Tools/rancher-gaucho
05/01/2018 02:11:25[webhook] 2018/01/05 05:11:25 [e203bc] incoming HTTP request from 192.168.99.1:51841
05/01/2018 02:11:25[webhook] 2018/01/05 05:11:25 [e203bc] redeploy-webhook got matched
05/01/2018 02:11:25[webhook] 2018/01/05 05:11:25 [e203bc] redeploy-webhook hook triggered successfully
05/01/2018 02:11:25[webhook] 2018/01/05 05:11:25 200 | 170.475碌s | 192.168.99.100:9000 | GET /hooks/redeploy-webhook
05/01/2018 02:11:25[webhook] 2018/01/05 05:11:25 unable to locate command: '/var/scripts/redeploy.sh'
Cheers
Try changing RUN chmod +x /var/scripts
into RUN chmod +x /var/scripts/redeploy.sh
Seems working but got this
05/01/2018 10:45:58[webhook] 2018/01/05 13:45:58 [b98734] incoming HTTP request from 192.168.99.1:50902
05/01/2018 10:45:58[webhook] 2018/01/05 13:45:58 [b98734] redeploy-webhook got matched
05/01/2018 10:45:58[webhook] 2018/01/05 13:45:58 [b98734] redeploy-webhook hook triggered successfully
05/01/2018 10:45:58[webhook] 2018/01/05 13:45:58 200 | 154.473碌s | 192.168.99.100:9000 | GET /hooks/redeploy-webhook
05/01/2018 10:45:58[webhook] 2018/01/05 13:45:58 [b98734] executing /var/scripts/redeploy.sh (/var/scripts/redeploy.sh) with arguments ["/var/scripts/redeploy.sh"] and environment [] using /var/scripts as cwd
05/01/2018 10:45:58[webhook] 2018/01/05 13:45:58 [b98734] command output:
05/01/2018 10:45:58[webhook] 2018/01/05 13:45:58 [b98734] error occurred: fork/exec /var/scripts/redeploy.sh: no such file or directory
05/01/2018 10:45:58[webhook] 2018/01/05 13:45:58 [b98734] finished handling redeploy-webhook
I was using #!/bin/bash instead of #!/bin/sh in my script.
Awesome! Happy hacking :-)
I thank you for the tool! I've never used Webhook. And now I can see how it makes life so much easier xD
Most helpful comment
Try changing
RUN chmod +x /var/scriptsinto
RUN chmod +x /var/scripts/redeploy.sh