Error Using ask deploy in Azure DevOps Release

521 Views Asked by At

Scenario

I am attempting to run ask deploy to deploy an Alexa Skill from a ubuntu-20.04 release agent in Azure DevOps. I'm using an AWS Shell Script task, which according to the description

Runs a shell script in Bash, setting AWS credentials and region information into the shell environment using the standard environment keys AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN and AWS_REGION.

I have the credentials set in DevOps as a Service Connection, so it really does have secure access to those values. So now that this task exposes my access key, secret, and region, I simply added a script to export the final two env vars needed for (I thought) successful execution:

export ASK_REFRESH_TOKEN="$(ASK_REFRESH_TOKEN)"
export ASK_VENDOR_ID="$(ASK_VENDOR_ID)"

Just to make sure that it's working I added ask smapi get-vendor-list to the script and I get the expected output which shows my vendor ID, name, and roles. Cool -- it must be working.

Problem

Now when ask deploy I get the following error:

CliError: Skill package src is not found in ask-resources.json

and I don't seem to be able to circumvent it.

I've Already Tried...

  1. Downloading the build artifact and running ask deploy locally. That works, so I know there's not an issue with the composition of the build or the skill package.
  2. Updating the refresh token
  3. Verifying that the command is invoked from the correct directory
  4. Verifying that the directory contains the right files

Question

How can I solve that error and successfully ask deploy from a release agent?

Reference

I'm on ASK-CLI v2.16.0

Here's my ask-resources.json in case that's useful. The error mentions this file.

{
  "askcliResourcesVersion": "2020-03-31",
  "profiles": {
    "default": {
      "skillMetadata": {
        "src": "./skill-package"
      },
      "code": {
        "default": {
          "src": "./lambda"
        }
      },
      "skillInfrastructure": {
        "userConfig": {
          "runtime": "nodejs12.x",
          "handler": "index.handler",
          "templatePath": "./infrastructure/cfn-deployer/skill-stack.yaml",
          "awsRegion": "us-east-1"
        },
        "type": "@ask-cli/cfn-deployer"
      }
    }
  }
}

Release job definition:

enter image description here

Release Log:

####Task Permissions
Permissions for this task to call AWS service APIs depend on the activities in the supplied script.
2020-09-29T12:27:05.4760730Z ==============================================================================
2020-09-29T12:27:05.6858528Z Configuring credentials for task
2020-09-29T12:27:05.6863319Z ...configuring AWS credentials from service endpoint 'redacted'
2020-09-29T12:27:05.6863708Z ...endpoint defines standard access/secret key credentials
2020-09-29T12:27:05.6879415Z Configuring region for task
2020-09-29T12:27:05.6882489Z ...configured to use region us-east-1, defined in task.
2020-09-29T12:27:05.6917304Z [command]/usr/bin/bash /home/vsts/work/_temp/awsshellscript_2266.sh
2020-09-29T12:27:09.2056323Z npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
2020-09-29T12:27:15.3303791Z npm WARN deprecated [email protected]: this library is no longer supported
2020-09-29T12:27:20.4277268Z /usr/local/bin/ask -> /usr/local/lib/node_modules/ask-cli/bin/ask.js
2020-09-29T12:27:20.4466577Z 
2020-09-29T12:27:20.4475010Z > [email protected] install /usr/local/lib/node_modules/ask-cli/node_modules/dtrace-provider
2020-09-29T12:27:20.4476929Z > node-gyp rebuild || node suppress-error.js
2020-09-29T12:27:20.4477558Z 
2020-09-29T12:27:20.8448748Z gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/root/.cache/node-gyp/12.18.4"
2020-09-29T12:27:20.8507717Z gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/ask-cli/node_modules/dtrace-provider/.node-gyp"
2020-09-29T12:27:20.8519281Z gyp WARN install got an error, rolling back install
2020-09-29T12:27:20.8535248Z gyp WARN install got an error, rolling back install
2020-09-29T12:27:20.8551818Z gyp ERR! configure error 
2020-09-29T12:27:20.8555760Z gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/ask-cli/node_modules/dtrace-provider/.node-gyp'
2020-09-29T12:27:20.8559344Z gyp ERR! System Linux 5.4.0-1025-azure
2020-09-29T12:27:20.8560532Z gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
2020-09-29T12:27:20.8571334Z gyp ERR! cwd /usr/local/lib/node_modules/ask-cli/node_modules/dtrace-provider
2020-09-29T12:27:20.8572691Z gyp ERR! node -v v12.18.4
2020-09-29T12:27:20.8573700Z gyp ERR! node-gyp -v v5.1.0
2020-09-29T12:27:20.8574490Z gyp ERR! not ok 
2020-09-29T12:27:20.9460739Z 
2020-09-29T12:27:20.9462350Z > [email protected] postinstall /usr/local/lib/node_modules/ask-cli
2020-09-29T12:27:20.9463103Z > node postinstall.js
2020-09-29T12:27:20.9463477Z 
2020-09-29T12:27:20.9839474Z 
2020-09-29T12:27:20.9840246Z ================================================================================
2020-09-29T12:27:20.9844532Z ASK CLI collects telemetry to better understand customer needs. You can
2020-09-29T12:27:20.9845738Z OPT OUT and disable telemetry by setting the 'share_usage' key to 'false' 
2020-09-29T12:27:20.9846574Z in '~/.ask/cli_config'.
2020-09-29T12:27:20.9846928Z 
2020-09-29T12:27:20.9847554Z Learn more: https://developer.amazon.com/docs/alexa/smapi/ask-cli-telemetry.html
2020-09-29T12:27:20.9848513Z ================================================================================ 
2020-09-29T12:27:20.9848861Z 
2020-09-29T12:27:20.9933073Z + [email protected]
2020-09-29T12:27:20.9933710Z added 233 packages from 243 contributors in 13.497s
2020-09-29T12:27:21.2144126Z /home/vsts/work/r1/a/BuildArtifact/drop/projectname
2020-09-29T12:27:21.2154300Z total 44
2020-09-29T12:27:21.2155074Z drwxr-xr-x 6 vsts docker  4096 Sep 29 12:27 .
2020-09-29T12:27:21.2155522Z drwxr-xr-x 3 vsts docker  4096 Sep 29 12:27 ..
2020-09-29T12:27:21.2156597Z drwxr-xr-x 2 vsts docker  4096 Sep 29 12:27 .ask
2020-09-29T12:27:21.2157145Z -rw-r--r-- 1 vsts docker    46 Sep 29 12:27 .gitignore
2020-09-29T12:27:21.2157583Z -rw-r--r-- 1 vsts docker 11358 Sep 29 12:27 LICENSE.txt
2020-09-29T12:27:21.2158041Z -rw-r--r-- 1 vsts docker   537 Sep 29 12:27 ask-resources.json
2020-09-29T12:27:21.2158482Z drwxr-xr-x 3 vsts docker  4096 Sep 29 12:27 infrastructure
2020-09-29T12:27:21.2158917Z drwxr-xr-x 3 vsts docker  4096 Sep 29 12:27 lambda
2020-09-29T12:27:21.2159407Z drwxr-xr-x 4 vsts docker  4096 Sep 29 12:27 skill-package
2020-09-29T12:27:22.9397766Z {
2020-09-29T12:27:22.9398441Z   "vendors": [
2020-09-29T12:27:22.9398789Z     {
2020-09-29T12:27:22.9399540Z       "id": "***",
2020-09-29T12:27:22.9399972Z       "name": "redacted",
2020-09-29T12:27:22.9400496Z       "roles": [
2020-09-29T12:27:22.9400870Z         "ROLE_DEVELOPER"
2020-09-29T12:27:22.9401186Z       ]
2020-09-29T12:27:22.9401481Z     }
2020-09-29T12:27:22.9402201Z   ]
2020-09-29T12:27:22.9402497Z }
2020-09-29T12:27:23.9621180Z [Error]: CliError: Skill package src is not found in ask-resources.json.
0

There are 0 best solutions below