Open neeraj2k6 opened 5 years ago
Are you publishing the artifact in the build step?
Yes @Sbrenthughes artifact is published as well
hygieiaArtifactPublishStep artifactDirectory: '/home/jenkins/workspace/hygieia', artifactGroup: 'MY.OPS', artifactName: '*.xml', artifactVersion: '1.$BUILD_NUMBER'
Let me check this and get back to you. It will probably be a few days before I can respond just an fyi
@neeraj2k6 , I'm having the same issue , did you find the fix?
Not yet @jjoyneriv I am still working to find the answer. From my analysis so far, I could see the env having commits and last build artefacts under the pipelines collection in the database as soon the Jenkins plugin pushes it. But when the API call is made to show the product dashboard from the UI, it empties the commits/last built artefact information from pipelines collection in MongoDB.
Also, the SCM information from the deployment pipeline is not getting populated for the artefact because of the below condition: https://github.com/Hygieia/hygieia-publisher-jenkins-plugin/blob/d2b47bbd12eec2c03ad2fbab89da09fc50e41376/src/main/java/hygieia/builder/ArtifactBuilder.java#L112
@neeraj2k6 I will take a look and get back to you
Not yet @jjoyneriv I am still working to find the answer. From my analysis so far, I could see the env having commits and last build artefacts under the pipelines collection in the database as soon the Jenkins plugin pushes it. But when the API call is made to show the product dashboard from the UI, it empties the commits/last built artefact information from pipelines collection in MongoDB.
Also, the SCM information from the deployment pipeline is not getting populated for the artefact because of the below condition: https://github.com/Hygieia/hygieia-publisher-jenkins-plugin/blob/d2b47bbd12eec2c03ad2fbab89da09fc50e41376/src/main/java/hygieia/builder/ArtifactBuilder.java#L112
Are you using a pipeline job in Jenkins?
@rvema , Yes we are using a pipeline job in Jenkins
Please advise
`pipeline { agent { label 'jenkins-dind-ops' } environment { builddocker = true } parameters { choice(name: 'Environment', choices: "Dev\nSit\nCTC\nProd", description: 'Specify the environment for which hygieia need to be created/updated') } stages { stage('PipelineStageBuild') { steps { checkout scm
hygieiaArtifactPublishStep artifactDirectory: '/home/jenkins/workspace/hygieia', artifactGroup: 'MY.OPS', \
artifactName: '*.yml', artifactVersion: '0.0.4'
hygieiaDeployPublishStep applicationName: 'hygieiaDash', artifactDirectory: '/home/jenkins/workspace/hygieia', \
artifactGroup: 'MY.OPS', artifactName: '*.yml', artifactVersion: '0.0.4', buildStatus: 'Success', \
environmentName: "Dev"
}
}
}
}`
This is the jenkins file I have created for the pipeline. This does populate the pipeline widgets properly but when I create a product dashboard using this team dashboard. the deployment stages are empty as per the screenshot I posted originally.
@neeraj2k6 I will take a look and respond back.
Hi all, any updates or insights on this issue. Please advise.
My team dashboard looks like so -
My product dashboard looks like so -
My Jenkinsfile is like so -
`#!/usr/bin/env groovy
pipeline { agent { label 'master' } environment { GIT_BRANCH = 'master' } stages { stage('Checkout') { steps { checkout([$class: 'GitSCM', branches: [[name: '/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[url: 'http://138.68.227.181:7990/scm/hyg/hygieia-cloud.git']]]) } } stage('Build') { steps { sh 'hostname' sh 'ls -al' sh 'mvn -B -DskipTests clean package' sh 'mvn compile' sh 'ls -al' hygieiaBuildPublishStep buildStatus: 'InProgress' echo "GIT_BRANCH == ${GIT_BRANCH}" sh 'printenv' } post { success { hygieiaBuildPublishStep buildStatus: 'Success' } failure { hygieiaBuildPublishStep buildStatus: 'Failure' } } } stage('Unit Test') { steps { sh 'mvn test' sh 'ls -al' } post { always { junit 'target/surefire-reports/.xml' } } } stage('Static Analysis for Sonar') { steps { withSonarQubeEnv('sonarqube') { sh 'mvn clean verify sonar:sonar' } } } stage('Sonar Gate') { steps { sh 'echo "sonar gate ok"' } } stage('Create Package') { steps { sh 'mvn package' sh 'mvn install' sh 'ls -al target/' sh 'echo "publish to artifactory ok"' } } stage('Publish Package') { steps { hygieiaArtifactPublishStep artifactDirectory: 'target', artifactGroup: 'com.jacksonville.app', artifactName: '.jar', artifactVersion: "1.1.5-Snapshot-Hygieia-Cloud" sh 'sleep 150' } } stage('Deploy to DEV') { steps { hygieiaDeployPublishStep applicationName: 'my-jacksonvilleapp', artifactDirectory: 'target', artifactGroup: 'com.jacksonville.app', artifactName: '.jar', artifactVersion: "1.1.5-Snapshot-Hygieia-Cloud", buildStatus: 'InProgress', environmentName: 'DEV' sh 'echo "deploy to dev ok"' sh 'sleep 250' } post { success { hygieiaDeployPublishStep applicationName: 'my-jacksonvilleapp', artifactDirectory: 'target', artifactGroup: 'com.jacksonville.app', artifactName: '.jar', artifactVersion: "1.1.5-Snapshot-Hygieia-Cloud", buildStatus: 'Success', environmentName: 'DEV' } failure { hygieiaDeployPublishStep applicationName: 'my-jacksonvilleapp', artifactDirectory: 'target', artifactGroup: 'com.jacksonville.app', artifactName: '.jar', artifactVersion: "1.1.5-Snapshot-Hygieia-Cloud", buildStatus: 'Failure', environmentName: 'DEV' } } } stage('QA Canary') { steps { sh 'echo "execute qa canary"' } } stage('Deploy to QA') { steps { hygieiaDeployPublishStep applicationName: 'my-jacksonvilleapp', artifactDirectory: 'target', artifactGroup: 'com.jacksonville.app', artifactName: '.jar', artifactVersion: "1.1.5-Snapshot-Hygieia-Cloud", buildStatus: 'InProgress', environmentName: 'QA' sh 'echo "deploy to qa ok"' sh 'sleep 300' } post { success { hygieiaDeployPublishStep applicationName: 'my-jacksonvilleapp', artifactDirectory: 'target', artifactGroup: 'com.jacksonville.app', artifactName: '.jar', artifactVersion: "1.1.5-Snapshot-Hygieia-Cloud", buildStatus: 'Success', environmentName: 'QA' } failure { hygieiaDeployPublishStep applicationName: 'my-jacksonvilleapp', artifactDirectory: 'target', artifactGroup: 'com.jacksonville.app', artifactName: '.jar', artifactVersion: "1.1.5-Snapshot-Hygieia-Cloud", buildStatus: 'Failure', environmentName: 'QA' } } } stage('QA Smoke') { steps { sh 'echo "execute qa smoke"' } } stage('Deploy to Stage') { steps { hygieiaDeployPublishStep applicationName: 'my-jacksonvilleapp', artifactDirectory: 'target', artifactGroup: 'com.jacksonville.app', artifactName: '.jar', artifactVersion: "1.1.5-Snapshot-Hygieia-Cloud", buildStatus: 'InProgress', environmentName: 'STAGE' sh 'echo "deploy to stage ok"' sh 'sleep 300' } post { success { hygieiaDeployPublishStep applicationName: 'my-jacksonvilleapp', artifactDirectory: 'target', artifactGroup: 'com.jacksonville.app', artifactName: '.jar', artifactVersion: "1.1.5-Snapshot-Hygieia-Cloud", buildStatus: 'Success', environmentName: 'STAGE' } failure { hygieiaDeployPublishStep applicationName: 'my-jacksonvilleapp', artifactDirectory: 'target', artifactGroup: 'com.jacksonville.app', artifactName: '.jar', artifactVersion: "1.1.5-Snapshot-Hygieia-Cloud", buildStatus: 'Failure', environmentName: 'STAGE' } } } stage('Stage Canary') { steps { sh 'echo "execute stage canary"' } } stage('Stage Smoke') { steps { sh 'echo "execute stage canary"' } } stage('Deploy to Prod') { steps { hygieiaDeployPublishStep applicationName: 'my-jacksonvilleapp', artifactDirectory: 'target', artifactGroup: 'com.jacksonville.app', artifactName: '.jar', artifactVersion: "1.1.5-Snapshot-Hygieia-Cloud", buildStatus: 'InProgress', environmentName: 'PROD' sh 'echo "deploy to production ok"' sh 'sleep 420' } post { success { hygieiaDeployPublishStep applicationName: 'my-jacksonvilleapp', artifactDirectory: 'target', artifactGroup: 'com.jacksonville.app', artifactName: '.jar', artifactVersion: "1.1.5-Snapshot-Hygieia-Cloud", buildStatus: 'Success', environmentName: 'PROD' } failure { hygieiaDeployPublishStep applicationName: 'my-jacksonvilleapp', artifactDirectory: 'target', artifactGroup: 'com.jacksonville.app', artifactName: '*.jar', artifactVersion: "1.1.5-Snapshot-Hygieia-Cloud", buildStatus: 'Failure', environmentName: 'PROD' } } } stage('Prod Canary') { steps { sh 'echo "execute Prod canary"' } } stage('Prod Smoke') { steps { sh 'echo "execute Prod smoke"' } } stage('Pipeline End') { steps { sh 'echo "Pipeline End"' } } } } ` Also note null values in the Jenkins log when the hygieia functions are executed --
2019-10-30 18:29:00.146+0000 [id=897750] INFO hygieia.builder.CommitBuilder#buildCommits: Adding commit:null:null:268f4fe23932a8548e40d1166d35bec2305d2a08:update customer
2019-10-30 18:29:00.146+0000 [id=897750] INFO hygieia.builder.CommitBuilder#buildCommits: Adding commit:null:null:c9d2d4d15d647afda5bc7dfec6989f4944c9ddfa:unit tests
Hi, We have configured the deploy and pipeline widgets properly. Data is coming in them as expected. But when configuring the product dashboard, the environment box are empty as per below screenshot:
The widgets view is as below:
Hygieia publish step is configured as:
hygieiaDeployPublishStep applicationName: 'hygieiaDash', artifactDirectory: '/home/jenkins/workspace/hygieia', artifactGroup: 'MY.OPS', artifactName: '*.xml', artifactVersion: '1.$BUILD_NUMBER', buildStatus: 'Success', environmentName: params.Environment
global hygieia configuration are:
Please suggest what might be missed to get the commits against the environment.