From fbecfe972a3a7c7fd8fb38cbe375fea1b9962a4a Mon Sep 17 00:00:00 2001 From: Zhaochunjiang Date: Mon, 8 May 2023 07:44:48 +0000 Subject: [PATCH 1/7] add Jenkinsfile file --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..0ca3b96 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1 @@ +// Test page file \ No newline at end of file -- Gitee From 60a4cfab4714f756ac2900271dbe9472f7569693 Mon Sep 17 00:00:00 2001 From: Zhaochunjiang Date: Mon, 8 May 2023 07:51:22 +0000 Subject: [PATCH 2/7] update Jenkinsfile content Signed-off-by: Zhaochunjiang --- Jenkinsfile | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 116 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0ca3b96..8a9d4ec 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1 +1,116 @@ -// Test page file \ No newline at end of file +def giteeCommentHeader = "| Check Name | Build Result | Build Details |\n| --- | --- | --- |\n" +pipeline { + agent { node { label 'xxxx' } } + environment { + GITEE_TOKEN = credentials('xxxxxx') + } + + // stages + stages { + stage('prepare') { + steps { + sh '''#!/bin/bash -e + + test -f ci_tags.py && rm ci_tags.py* + wget https://gitee.com/openeuler/infrastructure/raw/master/ci/tools/ci_tags.py + python3 ci_tags.py $giteeTargetNamespace $giteeTargetRepoName $giteePullRequestIid $GITEE_TOKEN ATP + ''' + } + } + stage('Update and install rust') { + steps { + sh '''#!/bin/bash + # update repo + #sed -i "s#http://repo.openeuler.org#https://repo.huaweicloud.com/openeuler#g" /etc/yum.repos.d/openEuler.repo + sudo yum update + sudo yum install -y gcc cmake openssl openssl-devel protobuf-compiler git + export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static + export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup + + # install rustup package + cd ${HOME} + curl https://sh.rustup.rs -sSf -o rustup.sh && sh ./rustup.sh -y + source $HOME/.cargo/env && rustup update -- nightly + + # update cargo registry + cat > $HOME/.cargo/config << EOF + [source.crates-io] + registry = "https://github.com/rust-lang/crates.io-index" + replace-with = 'ustc' + + [source.ustc] + registry = "https://mirrors.ustc.edu.cn/crates.io-index" + + [http] + check-revoke = false +EOF + ''' + } + } + + stage('source code clone') { + steps { + sh '''#!/bin/bash + + git clone https://gitee.com/openeuler/signatrust.git + cd signatrust + git checkout -b pr_$giteePullRequestIid + git fetch origin pull/$giteePullRequestIid/head:master-$giteePullRequestIid + git merge --no-edit master-$giteePullRequestIid + ''' + } + } + + stage('cargo clippy') { + steps { + sh '''#!/bin/bash + + source $HOME/.cargo/env && cd signatrust + cargo +nightly clippy + ''' + } + } + + stage('cargo test') { + steps { + sh '''#!/bin/bash + + cd ignatrust + cargo +nightly test + ''' + } + } + + stage('cargo build') { + steps { + sh '''#!/bin/bash + + cd signatrust + cargo +nightly build + ''' + } + } + } + + + post { + success { + script { + comments = giteeCommentHeader + "| Infra Check | **success** :white_check_mark: | [#${currentBuild.fullDisplayName}](${env.BUILD_URL}/console) | \n" + sh "python3 ci_tags.py $giteeTargetNamespace $giteeTargetRepoName $giteePullRequestIid $GITEE_TOKEN ATS" + } + addGiteeMRComment comment: comments + echo 'succeeded!' + + } + + failure { + script { + comments = giteeCommentHeader + "| Infra Check | **failed** :x: | [#${currentBuild.fullDisplayName}](${env.BUILD_URL}/console) | \n" + sh "python3 ci_tags.py $giteeTargetNamespace $giteeTargetRepoName $giteePullRequestIid $GITEE_TOKEN ATF" + } + addGiteeMRComment comment: comments + echo 'failed!' + } + } +} -- Gitee From 086fda8d13207ac9a9e4aa1768e4f95bc2c686b2 Mon Sep 17 00:00:00 2001 From: Zhaochunjiang Date: Mon, 8 May 2023 22:58:26 +0000 Subject: [PATCH 3/7] update Jenkinsfile. Signed-off-by: Zhaochunjiang --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8a9d4ec..68c318f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,7 +5,6 @@ pipeline { GITEE_TOKEN = credentials('xxxxxx') } - // stages stages { stage('prepare') { steps { -- Gitee From d70db7102c38eeb15f4e67d5d5d689f967dfb193 Mon Sep 17 00:00:00 2001 From: Zhaochunjiang Date: Tue, 9 May 2023 01:39:25 +0000 Subject: [PATCH 4/7] update Jenkinsfile. Signed-off-by: Zhaochunjiang --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 68c318f..234480d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,7 @@ pipeline { environment { GITEE_TOKEN = credentials('xxxxxx') } - + // stages stages { stage('prepare') { steps { -- Gitee From 1aebbd73366616a08ae1a5fc2035cb8bd6499426 Mon Sep 17 00:00:00 2001 From: Zhaochunjiang Date: Tue, 9 May 2023 01:48:27 +0000 Subject: [PATCH 5/7] update Jenkinsfile. Signed-off-by: Zhaochunjiang --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 234480d..2dc6c9b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,7 @@ pipeline { environment { GITEE_TOKEN = credentials('xxxxxx') } - // stages + // stages steps stages { stage('prepare') { steps { -- Gitee From aeb9f8c0d75f91e5497aff7897f45e43e59a6599 Mon Sep 17 00:00:00 2001 From: Zhaochunjiang Date: Tue, 9 May 2023 01:59:55 +0000 Subject: [PATCH 6/7] update Jenkinsfile. Signed-off-by: Zhaochunjiang --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2dc6c9b..f911f4c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,7 @@ pipeline { environment { GITEE_TOKEN = credentials('xxxxxx') } - // stages steps + // stages steps test branch stages { stage('prepare') { steps { -- Gitee From 6cbaff3bd74c53cb9cfd1400b64f1aca92d087fa Mon Sep 17 00:00:00 2001 From: Zhaochunjiang Date: Tue, 9 May 2023 11:10:53 +0000 Subject: [PATCH 7/7] update Jenkinsfile. Signed-off-by: Zhaochunjiang --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f911f4c..63bcb0b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,7 @@ pipeline { environment { GITEE_TOKEN = credentials('xxxxxx') } - // stages steps test branch + // stages stages { stage('prepare') { steps { -- Gitee