1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

GitLABとJenkinsのWebHook

Posted at

要件

CIツールのJenkinsでコンパイルし、Deployする

GitLabからWebhook飛ばしてJenkinsのJobを実行す
https://qiita.com/rk05231977/items/8b87b091eb6d45a370e1

Jenkinsマシンの試し

gitlabからソースチェックアウト

git ini
git remote add origin https://sfdjp13998.swf.nec.co.jp/gitlab/ALLProjectMember/saprise_poc_java.git
git pull
git branch -a
git checkout -b dev001 origin/dev001
git 

Webhook

JenkinsのToken

image.png

gitlabのWebhook

image.png

Pipeline

トークン
image.png

Jenkinsの設定のところ
image.png

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/529847/78ca7c64-e77b-b9df-ca71-2d9dd6d10b6e.png)

```pipeline {
    agent {
        label '1201041_build1013426'
    }
    environment {
        PATH = "C:\\Program Files\\Cloud Foundry;C:\\Program Files\\SapMachine\\JDK\\21\\BIN;${env.PATH}"
        JAVA_HOME = "C:\\Program Files\\SapMachine\\JDK\\21"
        HTTPS_PROXY = "http://proxygate2.nic.nec.co.jp:8080"
        CF_API_ENDPOINT = "https://api.cf.jp10.hana.ondemand.com"
    }

    stages {
        stage('Hello') {
            steps {
                echo 'Hello World'
                echo "PATH is: ${env.PATH}"
                echo "JAVA_HOME is: ${env.JAVA_HOME}"
                echo "HTTPS_PROXY is: ${env.HTTPS_PROXY}"
                echo "CF_API_ENDPOINT is: ${env.CF_API_ENDPOINT}"
                
            }
        }
    
        stage('Checkout') {
            steps {
                script {
                   // The below will clone your repo and will be checked out to master branch by default.
                   git branch: 'master',credentialsId: '63ead174-294f-4c05-9f92-0558740f8989', url: 'https://sfdjp13998.swf.nec.co.jp/gitlab/ALLProjectMember/saprise_poc_java.git'

                  }
                 bat 'gradlew.bat bootJar' 
                 bat 'cf8.exe login -u hu-chunqiang@ncontr.com -p hUcq1125 -a https://api.cf.jp10.hana.ondemand.com'
                 bat 'cf8.exe push'
             }
        }
        
    }
}

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?