Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

How do I trigger a build success or fail in jenkins based on a Release failing or succeeding



  • Hello I have setup Jenkins to run a buildmaster config file and I am using that config file in a windows powershell post build step in Jenkins. The powershell uses the API to Deploy a Package which it does fine. The issue I am having is that if that package fails in buildmaster the Jenkins job is still mark as success. My question is, is there a way to have buildmaster fail its associated jenkins job if it fails or is there a way to get a response from buildmaster when the package fails or succeeds so that jenkins can then mark the job as success or fail?

    Product: BuildMaster
    Version: 6.0.12



  • Assuming you are using the Deploy Package endpoint, you will receive a deployment id back as part of the return object. In your powershell script you could implement a "busy wait" where you check for the status of the deployment you kicked off by passing in the deployment id to the Get Deployments endpoint. If the status property is pending or executing then sleep for a few seconds and try again. You would also want to include some sort of maximum number of tries before failing the powershell script.



  • I ended up using powershell to add variables to a properties file of env.properties. Then used the "inject environment variables" post build step to add the file with those variables to by environment.

    #Powershell
    "APP_VERSION=$appVersion
    RELEASE_NUMBER_VAR=$releaseNumber
    IIS_APP_ROOT_NAME=$iisAppRootName
    APP_EMAIL=$appEmail" | Out-File env.properties -Encoding ASCII

    Then then used the Get-Release API to check and see if my selected release was a valid release. If not I created it with the Create-Release API.

    Then used the Inedo_BuildMaster Plugin for jenkins.
    Create BuildMaster Package - Post Build Step

    Variables:

    appEmail = ${APP_EMAIL}
    appVersion = ${APP_VERSION}
    buildNumber = ${BUILD_NUMBER}
    buildType = ${BuildTypeParam}
    iisAppRootName = ${IIS_APP_ROOT_NAME}
    iisHostNamePrefix = ${BuildTypeParam}

    After I figured out myself how to inject the Variables and use them properly this rout was much better because it let me know when the package was done deploying, if it failed, showed me the deployment log on failure and failed my Jenkins Job on Failure.

    Thank you for your answer though Josh!



Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation