3

I have created an Amazon Alexa Skill and I have also added ask-cli support to it. When I was trying to deploy it using ask-cli an error came i.e.

/bin/sh: 1: hooks/pre_deploy_hook.sh: Permission denied [Error]: Hook Scripts failed

Then, I opened Powershell as administrator and run the following command:

Set-ExecutionPolicy Unrestricted

After that I successfully deployed the skill from my system. Then I uploaded my project at gitlab and want to deploy it from gitlab CI/CD whenever a commit occurs in master branch. But it's showing the same hook script error. Then, I changed my .gitlab-ci.yml file for just changing the policy and not deploying the skill. Then again an error occurred.

Error Screenshot

Now, I want to deploy my skill throught gitlab ci/cd whenever a commit occurs in master branch and for that I need to set Exection Policy to Unrestricted. Please tell me how can do that.

mklement0
  • 382,024
  • 64
  • 607
  • 775
  • 1
    Please [edit](https://stackoverflow.com/posts/57636647/edit) your question and paste the error message in as formatted TEXT, not as a link to a screenshot. – Theo Aug 24 '19 at 09:23
  • 1
    AFAIK the `Set-ExecutionPolicy` cmdlet has not been ported to non-Windows OS. – Theo Aug 24 '19 at 09:25

1 Answers1

2

Note that the error message is complaining about a *.sh file, implying a Unix shell script (typically, a POSIX-like shell such as sh or bash), whereas Set-ExecutionPolicy applies exclusively to PowerShell scripts (*.ps1) - and isn't supported on Unix-like platforms at all.[1]

Specifically, the Permission denied error suggest that script file hooks/pre_deploy_hook.sh isn't executable (doesn't have executable permissions).

To make it executable (by anyone), run something like:

chmod a+x .git/hooks/pre_deploy_hook.sh

from your project folder.


[1] On Unix-like platforms, PowerShell's execution policies don't apply: in Windows terms, it's as if the Bypass policy were in effect (even though Get-ExecutionPolicy reports Unrestricted). An attempt to set the policy makes Set-ExecutionPolicy fail with Operation is not supported on this platform, as shown in your screenshot.

mklement0
  • 382,024
  • 64
  • 607
  • 775