1

I am trying to deploy an Mule application to On prem using Azure pipeline, below is the Azure-pipelines.yml

trigger:
    batch: true
    branches: 
        include: 
        - develop
    paths: 
        exclude: 
        - azure-pipelines.yml

variables:

- group: Build-Variable-Group
- name: MAVEN_CACHE_FOLDER
  value: $(HOME)/.m2/repository
- name: MAVEN_OPTS
  value: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'
- name: vmImageName
  value: 'ubuntu-latest'

stages:
- stage: Verify 
  displayName: Verification
  jobs:
  - job: VerifyApi
    displayName: Verify raml 
    pool:
      vmImage: $(vmImageName)
    
    steps:
    - task: PowerShell@2
      displayName: api folder 
      inputs:
        targetType: 'inline'
        script: |
          $Folder = '$(Build.SourcesDirectory)/src/main/resources/api'
          "Test to see if folder [$Folder]  exists"
          if (Test-Path -Path $Folder) {
            echo "$Folder"
            "Path exists!"
          } else {
              "RAML doesn't exit in the GITHUB repository"
              exit 1 
          }
          
- stage: Build 
  displayName: Build stage
  jobs:
  - job: BuildApiManager
    displayName: Build API Manager
    pool:
      vmImage: $(vmImageName)

    steps:
    - task: CacheBeta@0
      inputs:
        key: pom.xml
        path: $(MAVEN_CACHE_FOLDER)
      displayName: Cache Maven local Repo

    - task: DownloadSecureFile@1
      name: settingsxml
      inputs:
        secureFile: 'settings.xml'

    - task: Powershell@2
      inputs:
        targetType: 'inline'
        script: |
            New-Item -Type Directory -Force "${HOME}/.m2"
            Copy-Item -Force "$(settingsxml.secureFilePath)" "${HOME}/.m2/settings.xml"


    
    - task: Maven@3
      displayName: Deploy API Manager
      inputs:
        mavenPomFile: 'pom.xml'
        mavenOptions: '-Xmx3072m'
        javaHomeOption: 'JDKVersion'
        jdkVersionOption: '1.8'
        jdkArchitectureOption: 'x64'
        publishJUnitResults: true
        testResultsFiles: '**/surefire-reports/TEST-*.xml'
        goals: 'clean package -Papi-Danypoint.user=${anypoint.uname} -Danypoint.password=${anypoint.pass} -DorgId=${org.id} -Dversion=${apiVersion} -DenvId=${environment} -DdeploymentType=hybrid -Dpackaging=pom -DassetId=${app.name} -Dpolicy=${policy1}'
        
- stage: Deploy
  displayName: Deploy stage
  dependsOn: Build
  condition: succeeded()
  jobs:
  - job: DeployArtifacts
    displayName: Deploy & Publish Artifacts
    pool:
      vmImage: $(vmImageName)

    steps:
    - task: CacheBeta@0
      inputs:
        key: pom.xml
        path: $(MAVEN_CACHE_FOLDER)
      displayName: Cache Maven local Repo

    - task: DownloadSecureFile@1
      name: settingsxml
      inputs:
        secureFile: 'settings.xml'
    - task: Powershell@2
      inputs:
        targetType: 'inline'
        script: |
            New-Item -Type Directory -Force "${HOME}/.m2"
            Copy-Item -Force "$(settingsxml.secureFilePath)" "${HOME}/.m2/settings.xml"
    - task: Maven@3
      displayName: Deploy Runtime Manager 
      inputs:
        mavenPomFile: 'pom.xml'
        mavenOptions: '-Xmx3072m'
        javaHomeOption: 'JDKVersion'
        jdkVersionOption: '1.8'
        jdkArchitectureOption: 'x64'
        publishJUnitResults: true
        testResultsFiles: '**/surefire-reports/TEST-*.xml'
        goals: 'clean install deploy $(MAVEN_OPTS) -DmuleDeploy -Dserver=$(server) -Denvironment=$(environment) -Dworkers=$(workers) -DworkerType=$(workerType) -Dapp.runtime=$(app.runtime) -Dapp.name=$(app.name)'

Blow is the error I am getting in Azure pipeline log

[ERROR] Failed to execute goal org.mule.tools.maven:mule-maven-plugin:3.3.5:deploy (default-deploy) on project clx-mule-sftp-sapi: Failed to deploy [/home/vsts/work/1/s/target/clx-mule-sftp-sapi-1.0.1-SNAPSHOT-mule-application.jar] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

And below is the error which i am getting in Runtime manager log

Worker(3.81.37.13): Your application has failed with exception java.lang.IllegalStateException: com.mulesoft.ch.services.agent.muleAgent.MuleAgentException: {"type":"class java.lang.IllegalArgumentException","message":"There was an error on the Mule Runtime while deploying the application clx-mule-sftp-sapi-pdv2. Error: Domain 'domain-sys-api-1.0.1-mule-domain' has to be deployed in order to deploy Application 'clx-mule-sftp-sapi-pdv2'. DomainNotFoundException: The domain 'domain-sys-api-1.0.1-mule-domain' was not found. Available domains: [[default]]"}

We are able to deploy in cloudhub with same code but while trying to deploy in on-prem using same code ( changed the variables as per env ) it is showing error.

aled
  • 21,330
  • 3
  • 27
  • 34

1 Answers1

1

The error clearly indicates that the application depends on a domain:

Error: Domain 'domain-sys-api-1.0.1-mule-domain' has to be deployed in order to deploy Application 'clx-mule-sftp-sapi-pdv2'

You need to deploy the domain first before attempting to deploy the application. The steps are similar to deploy an application. See the documentation for details.

It is not possible that you deployed the same application to CloudHub since it doesn't support domains. I guess that you are referring to reusing the same deployment model. You need to understand the difference in the features between the different deployment targets.

aled
  • 21,330
  • 3
  • 27
  • 34