Remove the offline flag of maven command

This commit is contained in:
rick 2021-11-11 16:27:34 +08:00
parent d28d422b23
commit 7ea83703a8
No known key found for this signature in database
GPG Key ID: 260A80C757EC6783
9 changed files with 19 additions and 24 deletions

View File

@ -121,7 +121,7 @@ In this example, all workloads are deployed in `kubesphere-sample-dev`. You must
stage ('build & push') {
steps {
container ('maven') {
sh 'mvn -o -Dmaven.test.skip=true clean package'
sh 'mvn -Dmaven.test.skip=true clean package'
sh 'docker build -f Dockerfile-online -t $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER .'
withCredentials([usernamePassword(passwordVariable : 'DOCKER_PASSWORD' ,usernameVariable : 'DOCKER_USERNAME' ,credentialsId : "$DOCKER_CREDENTIAL_ID" ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'

View File

@ -144,9 +144,8 @@ You must create the projects as shown in the table below in advance. Make sure y
stage('unit test') {
steps {
container('maven') {
sh 'mvn clean -o -gs `pwd`/configuration/settings.xml test'
sh 'mvn clean test'
}
}
}
stage('sonarqube analysis') {
@ -154,7 +153,7 @@ You must create the projects as shown in the table below in advance. Make sure y
container('maven') {
withCredentials([string(credentialsId: "$SONAR_CREDENTIAL_ID", variable: 'SONAR_TOKEN')]) {
withSonarQubeEnv('sonar') {
sh "mvn sonar:sonar -o -gs `pwd`/configuration/settings.xml -Dsonar.login=$SONAR_TOKEN"
sh "mvn sonar:sonar -Dsonar.login=$SONAR_TOKEN"
}
}
@ -165,7 +164,7 @@ You must create the projects as shown in the table below in advance. Make sure y
stage('build & push') {
steps {
container('maven') {
sh 'mvn -o -Dmaven.test.skip=true -gs `pwd`/configuration/settings.xml clean package'
sh 'mvn -Dmaven.test.skip=true clean package'
sh 'docker build -f Dockerfile-online -t $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER .'
withCredentials([usernamePassword(passwordVariable : 'DOCKER_PASSWORD' ,usernameVariable : 'DOCKER_USERNAME' ,credentialsId : "$DOCKER_CREDENTIAL_ID" ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'

View File

@ -67,7 +67,7 @@ With the above credentials ready, you can create a pipeline using an example Jen
DOCKERHUB_USERNAME = 'Docker Hub Username'
// Docker image name
APP_NAME = 'devops-go-sample'
// dockerhubid is the credentials ID you created in KubeSphere with Docker Hub Access Token
// 'dockerhubid' is the credentials ID you created in KubeSphere with Docker Hub Access Token
DOCKERHUB_CREDENTIAL = credentials('dockerhubid')
// the kubeconfig credentials ID you created in KubeSphere
KUBECONFIG_CREDENTIAL_ID = 'go'

View File

@ -146,7 +146,7 @@ Pipelines include [declarative pipelines](https://www.jenkins.io/doc/book/pipeli
3. Click **Add Nesting Steps** to add a nested step under the `maven` container. Select **shell** from the list and enter the following command in the command line. Click **OK** to save it.
```shell
mvn clean -o -gs `pwd`/configuration/settings.xml test
mvn clean test
```
{{< notice note >}}
@ -190,7 +190,7 @@ This stage uses SonarQube to test your code. You can skip this stage if you do n
7. Click **shell** and enter the following command in the command line for the sonarqube branch and authentication. Click **OK** to finish.
```shell
mvn sonar:sonar -o -gs `pwd`/configuration/settings.xml -Dsonar.login=$SONAR_TOKEN
mvn sonar:sonar -Dsonar.login=$SONAR_TOKEN
```
![sonarqube-shell-new](/images/docs/devops-user-guide/using-devops/create-a-pipeline-using-graphical-editing-panels/sonarqube-shell-new.png)
@ -220,7 +220,7 @@ This stage uses SonarQube to test your code. You can skip this stage if you do n
3. Click **Add Nesting Steps** under the `maven` container to add a nested step. Select **shell** from the list, and enter the following command in the displayed dialog box. Click **OK** to finish.
```shell
mvn -o -Dmaven.test.skip=true -gs `pwd`/configuration/settings.xml clean package
mvn -Dmaven.test.skip=true clean package
```
![nested-step-maven](/images/docs/devops-user-guide/using-devops/create-a-pipeline-using-graphical-editing-panels/nested-step-maven.png)

View File

@ -136,9 +136,8 @@ pipeline {
stage('unit test') {
steps {
container('maven') {
sh 'mvn clean -o -gs `pwd`/configuration/settings.xml test'
sh 'mvn clean test'
}
}
}
stage('sonarqube analysis') {
@ -146,7 +145,7 @@ pipeline {
container('maven') {
withCredentials([string(credentialsId: "$SONAR_CREDENTIAL_ID", variable: 'SONAR_TOKEN')]) {
withSonarQubeEnv('sonar') {
sh "mvn sonar:sonar -o -gs `pwd`/configuration/settings.xml -Dsonar.login=$SONAR_TOKEN"
sh "mvn sonar:sonar -Dsonar.login=$SONAR_TOKEN"
}
}
@ -157,7 +156,7 @@ pipeline {
stage('build & push') {
steps {
container('maven') {
sh 'mvn -o -Dmaven.test.skip=true -gs `pwd`/configuration/settings.xml clean package'
sh 'mvn -Dmaven.test.skip=true clean package'
sh 'docker build -f Dockerfile-online -t $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER .'
withCredentials([usernamePassword(passwordVariable : 'DOCKER_PASSWORD' ,usernameVariable : 'DOCKER_USERNAME' ,credentialsId : "$DOCKER_CREDENTIAL_ID" ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'

View File

@ -121,7 +121,7 @@ kubectl get cm -n kubesphere-devops-system ks-devops-agent -o yaml
stage ('build & push') {
steps {
container ('maven') {
sh 'mvn -o -Dmaven.test.skip=true clean package'
sh 'mvn -Dmaven.test.skip=true clean package'
sh 'docker build -f Dockerfile-online -t $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER .'
withCredentials([usernamePassword(passwordVariable : 'DOCKER_PASSWORD' ,usernameVariable : 'DOCKER_USERNAME' ,credentialsId : "$DOCKER_CREDENTIAL_ID" ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'

View File

@ -144,9 +144,8 @@ weight: 11440
stage('unit test') {
steps {
container('maven') {
sh 'mvn clean -o -gs `pwd`/configuration/settings.xml test'
sh 'mvn clean test'
}
}
}
stage('sonarqube analysis') {
@ -154,18 +153,16 @@ weight: 11440
container('maven') {
withCredentials([string(credentialsId: "$SONAR_CREDENTIAL_ID", variable: 'SONAR_TOKEN')]) {
withSonarQubeEnv('sonar') {
sh "mvn sonar:sonar -o -gs `pwd`/configuration/settings.xml -Dsonar.login=$SONAR_TOKEN"
sh "mvn sonar:sonar -Dsonar.login=$SONAR_TOKEN"
}
}
}
}
}
stage('build & push') {
steps {
container('maven') {
sh 'mvn -o -Dmaven.test.skip=true -gs `pwd`/configuration/settings.xml clean package'
sh 'mvn -Dmaven.test.skip=true clean package'
sh 'docker build -f Dockerfile-online -t $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER .'
withCredentials([usernamePassword(passwordVariable : 'DOCKER_PASSWORD' ,usernameVariable : 'DOCKER_USERNAME' ,credentialsId : "$DOCKER_CREDENTIAL_ID" ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'

View File

@ -67,7 +67,7 @@ weight: 11410
DOCKERHUB_USERNAME = 'Docker Hub Username'
// Docker 镜像名称
APP_NAME = 'devops-go-sample'
// dockerhubid 是您在 KubeSphere 用 Docker Hub 访问令牌创建的凭证 ID
// 'dockerhubid' 是您在 KubeSphere 用 Docker Hub 访问令牌创建的凭证 ID
DOCKERHUB_CREDENTIAL = credentials('dockerhubid')
// 您在 KubeSphere 创建的 kubeconfig 凭证 ID
KUBECONFIG_CREDENTIAL_ID = 'go'

View File

@ -146,7 +146,7 @@ KubeSphere 中的图形编辑面板包含用于 Jenkins [阶段 (Stage)](https:/
3. 点击**添加嵌套步骤**,在 `maven` 容器下添加一个嵌套步骤。在列表中选择 **shell** 并在命令行中输入以下命令。点击**确定**保存操作。
```shell
mvn clean -o -gs `pwd`/configuration/settings.xml test
mvn clean test
```
{{< notice note >}}
@ -190,7 +190,7 @@ KubeSphere 中的图形编辑面板包含用于 Jenkins [阶段 (Stage)](https:/
7. 点击 **shell** 并在命令行中输入以下命令,用于 sonarqube 分支和认证,点击**确定**完成操作。
```shell
mvn sonar:sonar -o -gs `pwd`/configuration/settings.xml -Dsonar.login=$SONAR_TOKEN
mvn sonar:sonar -Dsonar.login=$SONAR_TOKEN
```
![新的 SonarQube shell](/images/docs/zh-cn/devops-user-guide/use-devops/create-a-pipeline-using-graphical-editing-panel/sonarqube_shell_new.png)
@ -220,7 +220,7 @@ KubeSphere 中的图形编辑面板包含用于 Jenkins [阶段 (Stage)](https:/
3. 点击 `maven` 容器下的**添加嵌套步骤**添加一个嵌套步骤。在列表中选择 **shell** 并在弹出窗口中输入以下命令,点击**确定**完成操作。
```shell
mvn -o -Dmaven.test.skip=true -gs `pwd`/configuration/settings.xml clean package
mvn -Dmaven.test.skip=true clean package
```
![maven 嵌套步骤](/images/docs/zh-cn/devops-user-guide/use-devops/create-a-pipeline-using-graphical-editing-panel/nested_step_maven.png)