We're updating our terminology in Jira

'Issue' is changing to 'work item'. You might notice some inconsistencies while this big change takes place.

Jenkins によるデプロイ の追跡を使用する

Jira Service Management の Free プランとスタンダードプランの変更

2024 年 10 月 16 日より、Jira Service Management の変更管理はスタンダード プランからプレミアム プランに移行します。この日以降、これらの機能にアクセスできるのは、プレミアム プランとエンタープライズ プランのみとなります。

Free プランと Standard プランの既存のプロジェクトは、既存のリクエスト タイプと作業タイプを引き続きサポートします。プランの変更に関する詳細をご確認ください。

デプロイの追跡を使用すると、Jenkins パイプラインの任意の段階から変更リクエストを自動的に作成または更新できます。変更に関係者の承認が必要ない場合は、デプロイの追跡を使用します。関係者の承認が必要な場合は、デプロイのゲーティングを使用します。

デプロイの追跡を使用するには、次の手順を実行する必要があります。

Jenkins によるデプロイの追跡を使用するには、次の手順を実行します。

  1. Jenkinsfile に移動します。

  2. Jira に通知したいパイプラインの段階を見つけます。

  3. sendJiraDeploymentInfo ブロックを段階ステップに追加して、Jira Service Management プロジェクトからコピーした Jira サイト名環境 ID環境タイプサービス IDを置換します。

スニペットの例

stage('Production') { steps { // Notify Jira a new deployment has started jiraSendDeploymentInfo ( environmentId: 'us-prod-1', environmentName: 'us-prod-1', environmentType: 'production', serviceIds: [ '<YOUR-SERVICE-ID>' ], site: '<YOUR-SITE>.atlassian.net', state: 'in_progress' ) sh 'echo Deploy to Production starting...' } post { always { sh 'sleep 2' sh 'echo Deployment to production finished' } success { echo 'Deployment successful' // Notify Jira if the deployment succeeded jiraSendDeploymentInfo ( environmentId: 'us-prod-1', environmentName: 'us-prod-1', environmentType: 'production', serviceIds: [ '<YOUR-SERVICE-ID>' ], site: '<YOUR-SITE>.atlassian.net', state: 'successful' ) } failure { echo 'Deployment failed' // Notify Jira if the deployment succeeded jiraSendDeploymentInfo ( environmentId: 'us-prod-1', environmentName: 'us-prod-1', environmentType: 'production', serviceIds: [ '<YOUR-SERVICE-ID>' ], site: '<YOUR-SITE>.atlassian.net', state: 'failed' ) } } } }

 

完全な Jenkinsfile の例

本番へのデプロイが開始されたら Jira に通知し、デプロイが終了したらもう一度通知します。 

pipeline { agent any stages { stage('Build') { steps { sh 'echo Run build...' } } stage('Test') { steps { sh 'echo Run tests...' } } stage('Stage') { steps { sh 'echo Deploy to Staging...' } } stage('Production') { steps { jiraSendDeploymentInfo ( environmentId: 'us-prod-1', environmentName: 'us-prod-1', environmentType: 'production', serviceIds: [ '<YOUR-SERVICE-ID>' ], site: '<YOUR-SITE>.atlassian.net', state: 'in_progress' ) sh 'echo Deploy to Production starting...' } post { always { sh 'sleep 2' sh 'echo Deployment to production finished' } // Notify Jira based on deployment step result success { echo 'Deployment successful' jiraSendDeploymentInfo ( environmentId: 'us-prod-1', environmentName: 'us-prod-1', environmentType: 'production', serviceIds: [ '<YOUR-SERVICE-ID>' ], site: '<YOUR-SITE>.atlassian.net', state: 'successful' ) } failure { echo 'Deployment failed' jiraSendDeploymentInfo ( environmentId: 'us-prod-1', environmentName: 'us-prod-1', environmentType: 'production', serviceIds: [ '<YOUR-SERVICE-ID>' ], site: '<YOUR-SITE>.atlassian.net', state: 'failed' ) } aborted { echo 'Deployment cancelled' jiraSendDeploymentInfo ( environmentId: 'us-prod-1', environmentName: 'us-prod-1', environmentType: 'production', serviceIds: [ '<YOUR-SERVICE-ID>' ], site: '<YOUR-SITE>.atlassian.net', state: 'cancelled' ) } } } } }

 

さらにヘルプが必要ですか?

アトラシアン コミュニティをご利用ください。