Using Github Actions on a self hosted runner for d...
# sdf
t
Using Github Actions on a self hosted runner for deployment and environment synchronization and since the update to Oauth 2.0, my action continues to fail with an error code 127. Maybe someone can see what I am still missing in my configuration. Only pieces changed is the installation of the suitecloud package and authentication variables. npm install -g --acceptSuiteCloudSDKLicense @oracle/suitecloud-cli 56 shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0} 57 env: 58 JAVA_HOME: /opt/actions-runner/_work/_tool/Java_Oracle_jdk/17/x64 59 JAVA_HOME_17_X64: /opt/actions-runner/_work/_tool/Java_Oracle_jdk/17/x64 60 61 changed 58 packages in 10s 62 15 packages are looking for funding 63 run
npm fund
for details 65 echo * | base64 -d > /tmp/private-key.pem 66 shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0} 67 env: 68 JAVA_HOME: /opt/actions-runner/_work/_tool/Java_Oracle_jdk/17/x64 69 JAVA_HOME_17_X64: /opt/actions-runner/_work/_tool/Java_Oracle_jdk/17/x64 71 ./node_modules/.bin/suitecloud accountsetupci --account ** --authid ***** --certificateid * --privatekeypath /tmp/private-key.pem 72 shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0} 73 env: 74 JAVA_HOME: /opt/actions-runner/_work/_tool/Java_Oracle_jdk/17/x64 75 JAVA_HOME_17_X64: /opt/actions-runner/_work/_tool/Java_Oracle_jdk/17/x64 76 /opt/actions-runner/_work/_temp/34c20b99-4da0-46d9-9c63-094037dfbe4f.sh: line 1: ./node_modules/.bin/suitecloud: No such file or directory 77 Error: Process completed with exit code 127.
m
You are installing the tools globally and it's looking for them in
node_modules
t
I attempted to remove the /.node_modules/bin and just run suitecloud but doesn’t seem to locate it that way either.
m
Have you tried just installing locally?
npm install -D @oracle/suitecloud-cli
k
@Tim Roberson Did you get this sorted if not happy to have a call as I use GitHub actions and use SuiteCloud to deploy every hour.
t
Not yet. Any counsel would be appreciated.
j
We use Azure Devops (it’s got a similar pool of linux hosted servers) This is the start of the yaml template that does our validation. There’s a lot of bits in there that are proprietary (e.g. we have a json file that maps account customization packages to the netsuite instances that they should be validated/deployed against)
Copy code
parameters:
- name: nodeVersion
  type: string

- name: awsRegion
  type: string

- name: javaVersion
  type: string

- name: suiteCloudCliVersion
  type: string

- name: name
  type: string

- name: netsuiteDeploymentTargets
  type: string

- name: environmentKey
  type: string

steps:
  - checkout: self

  - task: NodeTool@0
    displayName: 📗 Set NodeJS ${{ parameters.nodeVersion }}
    inputs:
      versionSpec: ${{ parameters.nodeVersion }}

  - task: JavaToolInstaller@0
    displayName: 📙 Set Java ${{ parameters.javaVersion }}
    inputs:
      versionSpec:           ${{ parameters.javaVersion }}
      jdkArchitectureOption: x64
      jdkSourceOption:       PreInstalled

  - bash: npm install -g --acceptSuiteCloudSDKLicense @oracle/suitecloud-cli
    displayName: 🔽 Install SuiteCloud-CLI

  - task: S3Download@1
    displayName: 📥 Download Certificates from S3
    inputs:
      awsCredentials:  DevDeployments
      regionName:      ${{ parameters.awsRegion }}
      bucketName:      aura-system-tenant-configs
      sourceFolder:    netsuite_sdf_keys
      targetFolder:    $(Agent.TempDirectory)

  - bash: |
      bash $(System.DefaultWorkingDirectory)/apps/NetSuite/AccountCustomization/filter_certificates_by_account_name.sh \
      $(System.DefaultWorkingDirectory)/apps/NetSuite/Certificate/certificate_mapping.json \
      ${{ parameters.name }} \
      $(System.DefaultWorkingDirectory)/apps/NetSuite/AccountCustomization/filtered_certificate_mapping.json
    displayName: ✂️ Filter certificate_mapping.json to ${{ parameters.name }}
    workingDirectory: $(Agent.TempDirectory)

  - bash: cat $(System.DefaultWorkingDirectory)/apps/NetSuite/AccountCustomization/filtered_certificate_mapping.json
    displayName: debug print env filtered cert mapping file

  - bash: |
      bash account_setup.sh \
      $(System.DefaultWorkingDirectory)/apps/NetSuite/AccountCustomization/filtered_certificate_mapping.json \
      $(Agent.TempDirectory)/netsuite_sdf_keys
    displayName: 🔑 Set up Netsuite Auth for account customization packages
    workingDirectory: $(System.DefaultWorkingDirectory)/apps/NetSuite/AccountCustomization
    env:
      SUITECLOUD_CI: 1
      SUITECLOUD_CI_PASSKEY: $(SUITECLOUD_CI_PASSKEY_ADO_SECRET)

  - bash: |
      bash deploy.sh \
      $(System.DefaultWorkingDirectory)/apps/NetSuite/AccountCustomization/filtered_certificate_mapping.json \
      $(System.DefaultWorkingDirectory)/apps/NetSuite/AccountCustomization/${{ parameters.netsuiteDeploymentTargets }}
    failOnStderr: true
    displayName: 🚀 Deploy Netsuite account customization packages
    workingDirectory: $(System.DefaultWorkingDirectory)/apps/NetSuite/AccountCustomization
    env:
      SUITECLOUD_CI: 1
      SUITECLOUD_CI_PASSKEY: $(SUITECLOUD_CI_PASSKEY_ADO_SECRET)
Here’s our account setup shell script - runs through all the netsuite accounts we support and adds them to the CI server
Copy code
#!/bin/bash

# set -x # Debug output for this command

netsuiteCertificates=$1
privateKeyPath=$2

for row in $(jq -c ' map(.) | .[]' $netsuiteCertificates); do
  _jq() {
    echo ${row} | jq -r "${1}"
  }
  account=$(_jq '.account')
  authId=$(_jq '.authId')
  privateKeyFileName=$(_jq '.privateKeyFileName')
  publicKeyFileName=$(_jq '.publicKeyFileName')
  certificateId=$(_jq '.certificateId')
  
  echo "################################################################################################################"
  echo "###########   Setup for $authId    ###########"
  echo "##[group]account_setup.sh parameters"
  echo "##[debug]account: $account"
  echo "##[debug]authId: $authId"
  echo "##[debug]privateKeyFileName: $privateKeyFileName"
  echo "##[debug]publicKeyFileName: $publicKeyFileName"
  echo "##[debug]certificateId: $certificateId"
  echo "##[endgroup]"
  (
    cd Address
    suitecloud account:setup:ci \
    --account "$account" \
    --authid "$authId" \
    --certificateid "$certificateId" \
    --privatekeypath "$privateKeyPath/$privateKeyFileName" || true
  )
  echo "################################################################################################################"
done