Failure at Forge login through Azure DevOps

We are trying to develop a ADO pipeline to deploy forge APP into Jira cloud we couldn’t login to forge.

In Fact using the manual process we are able to login.

Please help to fix the issue.
We are writing the CI/CD AzDO pipeline to deploy code to our sandbox environment.

Here are the things we have already tried:

  1. We evaluated the deployment failure by each step and its being blocked at the forge login
  2. We also tested the same forge login locally it is working fine through the manual approach.
  3. Also, We added the service connection, passing the variables implicitly and explicitly.
  4. From Attlassian’s standpoint, we created an API Token and integrated an ADO plugin in the Jira cloud, striking at the same point.

pipeline code and logs :

trigger:
  branches:
    include:
      - master
 
pr:
  branches:
    include:
      - '*'
 
jobs:
  - job: Build
    displayName: 'Run Build'
    pool:
      vmImage: 'ubuntu-latest'
      variables:
        FORGE_EMAIL: $(FORGE_EMAIL)  # Define variable for Forge email
        FORGE_API_TOKEN: $(FORGE_API_TOKEN)  # Define variable for Forge API token
    steps:
      - task: NodeTool@0
        inputs:
          versionSpec: '20.11.0'
        displayName: 'Install Node.js'
 
      - checkout: self
 
      - script: |
          cd $(Build.SourcesDirectory)
          # Install Forge CLI
          npm install --global @forge/cli@latest --omit=optional
          npm uninstall keytar
          # Verify Forge CLI installation
          node --version
          docker --version
          which forge
          forge --version
        displayName: 'Install Forge CLI'
        
      - script: |
          cd $(Build.SourcesDirectory)
          forge settings set usage-analytics true
 
        displayName: 'Set Forge Analytics'
 
      - script: |  
          cd $(Build.SourcesDirectory)
          # variables:
          #   FORGE_EMAIL: $(FORGE_EMAIL)  # Define variable for Forge email
          #   FORGE_API_TOKEN: $(FORGE_API_TOKEN)  # Define variable for Forge API token
          echo $(FORGE_EMAIL)
          echo $(FORGE_API_TOKEN)
          ls
          forge --version
          forge lint
          #echo sucessful lint 
          forge deploy -e DEVELOPMENT --verbose
          #echo sucessful deployment
          forge install --upgrade --site <redacted>=apps-menu --product jira --non-interactive -e DEVELOPEMENT
          #echo sucessful installation 
        displayName: 'Forge deploy'

Error logs:

##[debug]Agent environment resources - Disk: / Available 20204.00 MB out of 74244.00 MB, Memory: Used 892.00 MB out of 6921.00 MB, CPU: Usage 10.46%

Error: Keytar error detected: The name org.freedesktop.secrets was not provided by any .service files
Something went wrong while accessing Secret Service API.

Rerunning the command with --verbose may give more details.

Error: Keytar error detected: The name org.freedesktop.secrets was not provided by any .service files
Something went wrong while accessing Secret Service API.

Error: Keytar error detected: The name org.freedesktop.secrets was not provided by any .service files
Something went wrong while accessing Secret Service API.
    at CredentialStoreImpl.wrapKeytarError (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/node_modules/@forge/cli-shared/out/auth/personal/credential-store.js:88:15)
    at CredentialStoreImpl.getCredentialsKeytar (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/node_modules/@forge/cli-shared/out/auth/personal/credential-store.js:113:18)
    at async CredentialStoreImpl.getCredentials (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/node_modules/@forge/cli-shared/out/auth/personal/credential-store.js:150:28)
    at async Command.actionProcessor (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/out/command-line/command.js:234:32)
    at async Command.parseAsync (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/node_modules/commander/lib/command.js:936:5)
    at async Command.parse (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/out/command-line/command.js:152:13)
    at async main (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/out/command-line/index.js:51:5)

Error: Keytar error detected: The name org.freedesktop.secrets was not provided by any .service files
Something went wrong while accessing Secret Service API.

Rerunning the command with --verbose may give more details.

##[debug]Exit code 1 received from tool '/usr/bin/bash'
##[debug]STDIO streams have closed for tool '/usr/bin/bash'
##[error]Bash exited with code '1'.
##[debug]Processed: ##vso[task.issue type=error;source=TaskInternal;]Bash exited with code '1'.
##[debug]task result: Failed
##[debug]Processed: ##vso[task.complete result=Failed;done=true;]

Welcome to the Atlassian developer community @SanishMRamankutty,

It looks like you are doing the right things with environment variables according to Forge’s continuous delivery guide. However, the errors seem to point to your extra step to remove keytar. I don’t think that step is recommended or supported by the Forge CLI.

Thanks @ibuchanan for the response ! We added the step of “npm uninstall keytar” to address the initial keytar error we encountered. However, even without executing this command, we continued to experience the keytar error.
It appears that the CLI assumes the need for a keychain, despite us utilizing environment variables to store that information.
We assume the keychain should ideally only be necessary if we were using the “forge login” command instead of relying on environment variables.

1 Like

Hi @ibuchanan Please let us know if there are any additional libraries need to be installed in default-agent-pool of Azure DevOps so as to get the forge authentication and execution successful.

@ravissomana,

Are there any errors? Can you explain more about the problem?

We are trying to develop a ADO pipeline to deploy forge APP into Jira cloud we couldn’t login to forge. Also tried uninstalling keytar but no luck we even tried the environment variables.

Error: Keytar error detected: The name org.freedesktop.secrets was not provided by any .service files

Something went wrong while accessing Secret Service API.
    at CredentialStoreImpl.wrapKeytarError (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/node_modules/@forge/cli-shared/out/auth/personal/credential-store.js:88:15)
    at CredentialStoreImpl.getCredentialsKeytar (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/node_modules/@forge/cli-shared/out/auth/personal/credential-store.js:113:18)
    at async CredentialStoreImpl.getCredentials (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/node_modules/@forge/cli-shared/out/auth/personal/credential-store.js:150:28)
    at async Command.actionProcessor (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/out/command-line/command.js:240:32)
    at async Command.parseAsync (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/node_modules/commander/lib/command.js:936:5)
    at async Command.parse (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/out/command-line/command.js:154:13)
    at async main (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/out/command-line/index.js:51:5)

if we are using the environment variable we are getting the below error

    at async MinimalGraphQLRunner.run (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/node_modules/@forge/cli-shared/out/graphql/minimal-graphql-runner.js:61:47)
    at async DebuggingGraphqlRunner.run (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/node_modules/@forge/cli-shared/out/graphql/debugging-graphql-runner.js:20:41)
    at async MutationAwareGraphQLClient.query (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/node_modules/@forge/cli-shared/out/graphql/mutation-aware-graphql-client.js:56:41)
    at async AppEnvironmentsGraphqlClient.getAppEnvironmentDetails (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/node_modules/@forge/cli-shared/out/graphql/app-environment-graphql-client.js:57:24)
    at async DeployController.getAppEnvironmentDetails (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/out/command-line/controller/deploy-controller.js:145:20)
    at async DeployController.run (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/out/command-line/controller/deploy-controller.js:157:28)
    at async Command.actionProcessor (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/out/command-line/command.js:252:28)
    at async Command.parseAsync (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/node_modules/commander/lib/command.js:936:5)
##[debug]Agent environment resources - Disk: / Available 20025.00 MB out of 74244.00 MB, Memory: Used 915.00 MB out of 6921.00 MB, CPU: Usage 2.91%

Upgrading your app on the Atlassian site.


Error: The API token on your machine is no longer valid.
    1) Get a new API token: https://id.atlassian.com/manage/api-tokens
    2) Set your email and the token to FORGE_EMAIL and FORGE_API_TOKEN environment variables.

@ravissomana,

Please do not uninstall keytar. That is not recommended, even if you won’t be storing secrets locally.

With your 2nd post, it looks like the problem isn’t with the CLI or env vars, but in the email & token provided. Did you supply Azure DevOps with the right env var names and values? Maybe generate a new API token?

@ibuchanan with the new API Token following is the error message.

    at async MinimalGraphQLRunner.run (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/node_modules/@forge/cli-shared/out/graphql/minimal-graphql-runner.js:61:47)
    at async DebuggingGraphqlRunner.run (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/node_modules/@forge/cli-shared/out/graphql/debugging-graphql-runner.js:20:41)
    at async MutationAwareGraphQLClient.query (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/node_modules/@forge/cli-shared/out/graphql/mutation-aware-graphql-client.js:56:41)
    at async AppEnvironmentsGraphqlClient.getAppEnvironmentDetails (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/node_modules/@forge/cli-shared/out/graphql/app-environment-graphql-client.js:57:24)
    at async DeployController.getAppEnvironmentDetails (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/out/command-line/controller/deploy-controller.js:145:20)
    at async DeployController.run (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/out/command-line/controller/deploy-controller.js:157:28)
    at async Command.actionProcessor (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/out/command-line/command.js:252:28)
    at async Command.parseAsync (/opt/hostedtoolcache/node/20.11.0/x64/lib/node_modules/@forge/cli/node_modules/commander/lib/command.js:936:5)
##[debug]Agent environment resources - Disk: / Available 20025.00 MB out of 74244.00 MB, Memory: Used 915.00 MB out of 6921.00 MB, CPU: Usage 2.91%

Upgrading your app on the Atlassian site.


Error: The API token on your machine is no longer valid.
    1) Get a new API token: https://id.atlassian.com/manage/api-tokens
    2) Set your email and the token to FORGE_EMAIL and FORGE_API_TOKEN environment variables.                                                                                                                                                   

Please find the below pipeline yaml code. Please let us know if there is any fix at this point of time.

trigger:
  branches:
    include:
      - master
 
pr:
  branches:
    include:
      - '*'
 
jobs:
  - job: Build
    displayName: 'Run Build'
    pool:
      vmImage: 'ubuntu-latest'
      variables:
        FORGE_EMAIL: $(FORGE_EMAIL)  # Define variable for Forge email
        FORGE_API_TOKEN: $(FORGE_API_TOKEN)  # Define variable for Forge API token
    steps:
      - task: NodeTool@0
        inputs:
          versionSpec: '20.11.0'
        displayName: 'Install Node.js'
 
      - checkout: self
 
      - script: |
          cd $(Build.SourcesDirectory)
          # Install Forge CLI
          npm install --global @forge/cli@latest
          # Verify Forge CLI installation
          node --version
          docker --version
          which forge
          forge --version
        displayName: 'Install Forge CLI'
        
      - script: |
          cd $(Build.SourcesDirectory)
          forge settings set usage-analytics true
 
        displayName: 'Set Forge Analytics'
 
      - script: |  
          cd $(Build.SourcesDirectory)
          export FORGE_EMAIL="FORGE_EMAIL"
          export FORGE_API_TOKEN="FORGE_API_TOKEN"
          echo $(FORGE_EMAIL)
          echo $(FORGE_API_TOKEN)
          ls
          forge --version
          forge lint
          forge deploy -e DEVELOPMENT --verbose
          forge install --upgrade --site ********************** --product jira --non-interactive -e DEVELOPEMENT
        displayName: 'Forge deploy'

@ravissomana,

This is quite puzzling. Can you confirm that the lint and deploy commands work, but only the install command fails? Or is that a setting on this pipeline that each command continues even if the last one failed?

@ibuchanan i think it is failing at the lint. i tried excluding lint command it is the same error message as previous

@ravissomana,

Maybe we could debug faster outside of Azure DevOps? Are you able to get the email & API token combination to work locally on your machine? You should be able to force the Forge CLI to work with env vars if you first forge logout.

Manual process is working fine. We need help to setup ADO pipeline.

@ravissomana,

I can offer nothing more. The error indicates a bad API Token. If you have proven the same API Token works on your local environment, then I can offer no explanation for the error message or the problem you’re facing.

We are able to deploy the application to jira cloud using ADO. Thank you so much for all the inputs @ibuchanan

1 Like