Azure DevOps distribute android app via appcenter not distributing

576 views Asked by At

I have a react native app building on Azure Devops ok,

now to create the distribution, it shows a grey arrow on the "jobs", and I cannot find the app distributed,

enter image description here

What is Result: False ?

here the yaml

trigger:
- master

pool:
  vmImage: 'macOS-10.14'

variables:
  - group: AndroidKeystore

steps:
- task: NodeTool@0
  displayName: 'Install Node'
  inputs:
    versionSpec: '12.16.1'

- script: npm install
  displayName: 'Install node dependencies'

- script: |
    npm i jetifier
    npx jetify
  displayName: 'npx'

- script: |
    rm -r android/app/src/main/res/drawable-*
    rm -r android/app/src/main/res/raw
  displayName: 'delete before'

- task: Gradle@2
  inputs:
    workingDirectory: 'android'
    gradleWrapperFile: 'android/gradlew'
    gradleOptions: '-Xmx3072m'
    publishJUnitResults: false
    testResultsFiles: '**/TEST-*.xml'
    tasks: 'assembleRelease'

- task: AndroidSigning@3
  inputs:
    apkFiles: '**/*.apk'
    apksign: true
    apksignerKeystoreFile: 'my-release-key.keystore'
    apksignerKeystorePassword: '$(jarsignerKeystorePassword)'
    apksignerKeystoreAlias: 'my-key-alias'
    apksignerKeyPassword: '$(jarsignerKeyPassword)'



- script: mv android/app/build/outputs/apk/release/app-release.apk ReactNativePipeline$(Build.BuildNumber).apk
  displayName: 'Rename apk'

- task: PublishBuildArtifacts@1
  inputs:
    pathtoPublish: ReactNativePipeline$(Build.BuildNumber).apk
    artifactName: drop
    publishLocation: 'container'

- task: AppCenterDistribute@3
  displayName: "Create a release on App Center"
  condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
  inputs:
    serverEndpoint: 'VSAC'
    appSlug: 'Wisr/WisrRN-Android2'
    appFile: 'ReactNativePipeline$(Build.BuildNumber).apk'
    releaseNotesOption: 'input'
    releaseNotesInput: |
      $(Build.SourceVersionMessage)
      
      latest source: '$(Build.SourceVersion)'
      
      An automated release from Azure DevOps
    destinationType: 'groups'
    distributionGroupId: 'testBench'

So how to make the build available on the specific group "testBench"

1

There are 1 answers

0
Kevin Lu-MSFT On BEST ANSWER

What is Result: False ?

This is the result of condition. From the task log, the Build.SourceBranch is refs/heads/androidPipe.

refs/heads/androidPipe eq refs/heads/master  Result: false

In your Yaml sample, the condition settings:

condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))

This means that when the Build.SourceBranch is master, it will run the AppCenterDistribute task. Or it will not run the task(Skip the task).

Here are two methods to solve this issue:

1.You could change the Condition:

condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/androidPipe'))

2.You could use the master branch to run the pipeline. Then the task will execute.

By the way, if you don't need this condition, you can also delete it. In this case, no matter what branch it is, this task will run.

For more detailed information, you could refer to this doc about Condition.