Munit test fails when deploying to Cloudhub using Azure Devops CI/CD Pipeline

509 views Asked by At

I created a munit test for the application and the test runs locally without any error, enter image description here

but when I try deploying in to the Cloudhub the Munit Test fail and below is the error detail

java.lang.IllegalStateException: Cannot start embedded container

Caused by: java.lang.IllegalArgumentException: Could not find embedded container bom artifact

Caused by: org.mule.maven.client.api.BundleDependenciesResolutionException: org.eclipse.aether.resolution.DependencyResolutionException: Could not transfer artifact com.mulesoft.services:mule-service-weave-ee:jar:mule-service:2.3.0-20210622 from/to mulesoft-private (https://repository.mulesoft.org/nexus/content/repositories/private/): authentication failed for https://repository.mulesoft.org/nexus/content/repositories/private/com/mulesoft/services/mule-service-weave-ee/2.3.0-20210622/mule-service-weave-ee-2.3.0-20210622-mule-service.jar, status: 401 Unauthorized

Caused by: org.eclipse.aether.resolution.DependencyResolutionException: Could not transfer artifact com.mulesoft.services:mule-service-weave-ee:jar:mule-service:2.3.0-20210622 from/to mulesoft-private (https://repository.mulesoft.org/nexus/content/repositories/private/): authentication failed for https://repository.mulesoft.org/nexus/content/repositories/private/com/mulesoft/services/mule-service-weave-ee/2.3.0-20210622/mule-service-weave-ee-2.3.0-20210622-mule-service.jar, status: 401 Unauthorized

Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact com.mulesoft.services:mule-service-weave-ee:jar:mule-service:2.3.0-20210622 from/to mulesoft-private (https://repository.mulesoft.org/nexus/content/repositories/private/): authentication failed for https://repository.mulesoft.org/nexus/content/repositories/private/com/mulesoft/services/mule-service-weave-ee/2.3.0-20210622/mule-service-weave-ee-2.3.0-20210622-mule-service.jar, status: 401 Unauthorized

Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact com.mulesoft.services:mule-service-weave-ee:jar:mule-service:2.3.0-20210622 from/to mulesoft-private (https://repository.mulesoft.org/nexus/content/repositories/private/): authentication failed for https://repository.mulesoft.org/nexus/content/repositories/private/com/mulesoft/services/mule-service-weave-ee/2.3.0-20210622/mule-service-weave-ee-2.3.0-20210622-mule-service.jar, status: 401 Unauthorized

Caused by: org.apache.maven.wagon.authorization.AuthorizationException: authentication failed for https://repository.mulesoft.org/nexus/content/repositories/private/com/mulesoft/services/mule-service-weave-ee/2.3.0-20210622/mule-service-weave-ee-2.3.0-20210622-mule-service.jar, status: 401 Unauthorized

I double checked the settings.xml is loaded in to the Secure Files under the Pipeline ->Libraries in Azure devops. We have other application which runs without any issues. I am experiencing the issue on this. Can anyone suggest what is that I might be missing here.

Below is the build stage of the POM file

stages:

- stage: 'Build'

 displayName: 'Build Application'

 jobs:

  - job:

   pool:

    vmImage: 'ubuntu-latest'

   variables:

    - ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/develop') }}:

     - group: mule-dev

    - ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/release') }}:

     - group: mule-test

    - ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}:

     - group: mule-prod

 

   steps:

   - checkout: self

 

   - task: DownloadSecureFile@1

    displayName: 'Download settings.xml'

    inputs:

     secureFile: 'settings.xml'

     retryCount: 5

 

   - task: Cache@2

    displayName: 'Cache Maven Local Repository'

    inputs:

     key: pom.xml

     path: '$(MAVEN_CACHE_FOLDER)'

 

   - task: Maven@3

    displayName: Run MUnit Tests (mvn test)

    inputs:

     publishJUnitResults: true

     goals: 'clean test'

     options: '-s $(Agent.TempDirectory)/settings.xml $(CLOUDHUB_RUNTIME_PROPERTIES)'

 

   - task: Maven@3

    displayName: Generate Mule Application JAR (mvn package)

    inputs:

     goals: 'clean package -DskipTests'

     options: '$(MAVEN_OPTS) $(CLOUDHUB_RUNTIME_PROPERTIES)'

     publishJUnitResults: false

     javaHomeOption: 'JDKVersion'

     jdkVersionOption: '1.8'

 

   - task: PublishBuildArtifacts@1

    displayName: Publish Mule Application JAR

    inputs:

     PathtoPublish: '$(Build.SourcesDirectory)/target/'

     publishLocation: 'Container'

This content is a preview of a link.repository.mulesoft.org

0

There are 0 answers