最近の検索


最近の検索はありません

Shafeeq TS's Avatar

Shafeeq TS

参加日2024年7月29日

·

前回のアクティビティ2024年7月31日

フォロー中

0

フォロワー

0

合計アクティビティ

6

投票

1

受信登録

2

アクティビティの概要

さんの最近のアクティビティ Shafeeq TS

Shafeeq TSさんがコメントを作成しました:

コミュニティのコメント Developer - Zendesk Apps Framework (ZAF)

Greg Katechis thanks for the quick response. Good to know that the fix is on its way :)

I had commented on the other thread because When I added a timeout to the update task in the pipeline, it showed a trace to enter the token value.

Then I passed the OAuth token into the zcli.apps.config.json as Eric mentioned, but there was no change in the output.

 

Here is my pipeline code:

trigger: 'none'
  

pool:
  vmImage: 'ubuntu-latest'

variables:
  node_version: '16.x'
  ZENDESK_SUBDOMAIN: '##########'
  ZENDESK_EMAIL: '##############'
  ZENDESK_API_TOKEN: '###################'
  OAUTH_CLIENT_ID: '##########################'
  OAUTH_CLIENT_SECRET: '################################'
  OAUTH_TOKEN_URL: 'https://login.microsoftonline.com/##########################/oauth2/v2.0/token'
  OAUTH_SCOPE: 'api://####################/.default'  

steps:
- checkout: self
  displayName: 'Checkout Code'

- task: UseNode@1
  inputs:
    version: '$(node_version)'
  displayName: 'Use Node.js $(node_version)'

- script: |
    npm install -g @zendesk/zcli
  displayName: 'Install zcli'

- script: |
    cd $(Build.SourcesDirectory)/ZendeskAPP/DailyTime
    echo "Current directory: $(pwd)"
    ls -la
  displayName: 'List Directory Contents'

- script: |
    cd $(Build.SourcesDirectory)/ZendeskAPP/DailyTime
    zcli apps:validate
  displayName: 'Validate Zendesk App'

# Step to obtain OAuth token with debug information
- script: |
    echo "Requesting OAuth token..."
    TOKEN_RESPONSE=$(curl -v --request POST \
      --url $(OAUTH_TOKEN_URL) \
      --header 'content-type: application/x-www-form-urlencoded' \
      --data-urlencode "client_id=$(OAUTH_CLIENT_ID)" \
      --data-urlencode "client_secret=$(OAUTH_CLIENT_SECRET)" \
      --data-urlencode "grant_type=client_credentials" \
      --data-urlencode "scope=$(OAUTH_SCOPE)")
    
    echo "TOKEN_RESPONSE: $TOKEN_RESPONSE"
    ACCESS_TOKEN=$(echo $TOKEN_RESPONSE | jq -r '.access_token')
    
    # Print the obtained token
    echo "Obtained OAuth Token: $ACCESS_TOKEN"
 
    # Save the token to be used in the next steps
    echo "##vso[task.setvariable variable=ACCESS_TOKEN]$ACCESS_TOKEN"
  displayName: 'Obtain OAuth Token'

- script: |
    cd $(Build.SourcesDirectory)/ZendeskAPP/DailyTime
    jq --arg token "$(ACCESS_TOKEN)" '.parameters |= map(if .name == "token" then .value = $token else . end)' zcli.apps.config.json > tmp.$$.json && mv tmp.$$.json zcli.apps.config.json
    
    # Print the updated zcli.apps.config.json
    echo "Updated zcli.apps.config.json content:"
    cat zcli.apps.config.json
  displayName: 'Update zcli.apps.config.json with OAuth Token'

- script: |
    timeout 120 zcli apps:update $(Build.SourcesDirectory)/ZendeskAPP/DailyTime
    if [ $? -eq 124 ]; then
      echo "zcli apps:update command timed out"
      exit 1
    fi
    echo "Successfully updated app: Daily Time with app_id: $(APP_ID)"
  displayName: 'Update Zendesk App'
  condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'))

- script: |
    echo "Pipeline completed successfully."
    exit 0
  displayName: 'Finalize'

And the zcli.apps.config.json file is:

{
  
  "app_id": #######,
  "parameters": [
    {
      "name": "token",
      "type": "OAuth",
      "required": true,
      "secure": true,
      "value": "token_KEY"
    }
  ]
}

 

Any thoughts on this?

 

 

コメントを表示 · 投稿日時:2024年7月31日 · Shafeeq TS

0

フォロワー

0

投票

0

コメント


Shafeeq TSさんがコメントを作成しました:

コミュニティのコメント Developer - Zendesk Apps Framework (ZAF)

Jim Kim Can you please describe on how you managed to do it? We are facing a similar issue

コメントを表示 · 投稿日時:2024年7月30日 · Shafeeq TS

0

フォロワー

0

投票

0

コメント


Shafeeq TSさんが投稿を作成しました:

投稿 Developer - Zendesk Apps Framework (ZAF)

I have created a support app and set up a CI/CD pipeline using Azure DevOps with the zcli apps:update command. The app communicates with an external API hosted in Azure API Management with OAuth.

 

The problem is that the pipeline does not end even after updating the app. The update task is running indefinitely as shown in the screenshot.

 

Any help will be appreciated.

 

Thanks.

編集日時:2024年7月29日 · Shafeeq TS

0

フォロワー

2

投票

2

コメント