From b7d508eabd83991b03421527a8982c65b956eefb Mon Sep 17 00:00:00 2001 From: belly-rewardz Date: Wed, 27 Mar 2024 10:15:29 +0700 Subject: [PATCH 01/15] add dummy code --- src/code.py | 1 + src/manifest.yaml | 1 + 2 files changed, 2 insertions(+) create mode 100644 src/code.py create mode 100644 src/manifest.yaml diff --git a/src/code.py b/src/code.py new file mode 100644 index 0000000..6790b1c --- /dev/null +++ b/src/code.py @@ -0,0 +1 @@ +# dummy py code \ No newline at end of file diff --git a/src/manifest.yaml b/src/manifest.yaml new file mode 100644 index 0000000..822d43a --- /dev/null +++ b/src/manifest.yaml @@ -0,0 +1 @@ +# dummy yaml code \ No newline at end of file From 802280c678bdaad2af27518ff920358898f3c605 Mon Sep 17 00:00:00 2001 From: belly-rewardz Date: Wed, 27 Mar 2024 10:15:53 +0700 Subject: [PATCH 02/15] debug --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 8639fc8..e51848d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,6 +33,8 @@ options { echo "hello world 8" echo "hello world 9" echo "hello world 10" + sh "ls -lah" + sh "pwd" } } } From eb3c8835df651993c3d659e6064dd2578ecdce4c Mon Sep 17 00:00:00 2001 From: belly-rewardz Date: Wed, 27 Mar 2024 10:24:00 +0700 Subject: [PATCH 03/15] hw 11 --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index e51848d..26286d0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,6 +33,7 @@ options { echo "hello world 8" echo "hello world 9" echo "hello world 10" + echo "hello world 11" sh "ls -lah" sh "pwd" } From 2ebbe76ccfa18e2466012e8510ea3791f44c6a89 Mon Sep 17 00:00:00 2001 From: belly-rewardz Date: Wed, 27 Mar 2024 16:40:36 +0700 Subject: [PATCH 04/15] add debug --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 26286d0..9d05e66 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,6 +36,7 @@ options { echo "hello world 11" sh "ls -lah" sh "pwd" + sh "pwd" } } } From e054a5f0026a180a9955a8c00eea65c73b5486a9 Mon Sep 17 00:00:00 2001 From: belly-rewardz Date: Wed, 27 Mar 2024 16:50:44 +0700 Subject: [PATCH 05/15] debug --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 9d05e66..6c60249 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,6 +37,7 @@ options { sh "ls -lah" sh "pwd" sh "pwd" + sh "pwd || true" } } } From 1654061c79bfc57b2b5bb5f4a5050e9ba99c63a1 Mon Sep 17 00:00:00 2001 From: belly-rewardz Date: Wed, 27 Mar 2024 16:55:50 +0700 Subject: [PATCH 06/15] debug 1 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6c60249..e992d49 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -35,7 +35,7 @@ options { echo "hello world 10" echo "hello world 11" sh "ls -lah" - sh "pwd" + sh "pwd || true" sh "pwd" sh "pwd || true" } From 64c0ef97f49da64e74565cb666e16333a67b4f8f Mon Sep 17 00:00:00 2001 From: belly-rewardz Date: Wed, 27 Mar 2024 16:56:01 +0700 Subject: [PATCH 07/15] debug 2 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index e992d49..c95177c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,7 +36,7 @@ options { echo "hello world 11" sh "ls -lah" sh "pwd || true" - sh "pwd" + sh "pwd || true" sh "pwd || true" } } From f071377bde3062af6b5368975393092d224017b8 Mon Sep 17 00:00:00 2001 From: belly-rewardz Date: Wed, 27 Mar 2024 16:59:41 +0700 Subject: [PATCH 08/15] add py --- src/code.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/code.py b/src/code.py index 6790b1c..4c2467e 100644 --- a/src/code.py +++ b/src/code.py @@ -1 +1,3 @@ -# dummy py code \ No newline at end of file +# dummy py code + +print("random") \ No newline at end of file From 126201a800cec6e0305ae6bd17ba2eab98989d09 Mon Sep 17 00:00:00 2001 From: belly-rewardz Date: Wed, 27 Mar 2024 16:59:44 +0700 Subject: [PATCH 09/15] add yaml --- src/manifest.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/manifest.yaml b/src/manifest.yaml index 822d43a..acfc2ca 100644 --- a/src/manifest.yaml +++ b/src/manifest.yaml @@ -1 +1,3 @@ -# dummy yaml code \ No newline at end of file +# dummy yaml code + +name: demo \ No newline at end of file From 35ad85b50821b8298ddfb8592179eb50c8385d4b Mon Sep 17 00:00:00 2001 From: belly-rewardz Date: Thu, 30 May 2024 16:08:42 +0700 Subject: [PATCH 10/15] test --- Jenkinsfile | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c95177c..04c6428 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,19 +25,8 @@ options { container('node') { script { echo "hello world 2" - echo "hello world 3" - echo "hello world 4" - echo "hello world 5" - echo "hello world 6" - echo "hello world 7" - echo "hello world 8" - echo "hello world 9" - echo "hello world 10" - echo "hello world 11" sh "ls -lah" sh "pwd || true" - sh "pwd || true" - sh "pwd || true" } } } From 481589470704a5ef00ad975ebc65b6d2eb038b5b Mon Sep 17 00:00:00 2001 From: belly-rewardz Date: Thu, 30 May 2024 16:18:52 +0700 Subject: [PATCH 11/15] update commit status --- Jenkinsfile | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 04c6428..298defc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,3 +1,13 @@ +void setBuildStatus(String message, String state) { + step([ + $class: "GitHubCommitStatusSetter", + reposSource: [$class: "ManuallyEnteredRepositorySource", url: "https://github.com/belly-rewardz/webhook-trigger"], + contextSource: [$class: "ManuallyEnteredCommitContextSource", context: "ci/jenkins/build-status"], + errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]], + statusResultSource: [ $class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ] + ]); +} + pipeline { agent { kubernetes { @@ -32,4 +42,12 @@ options { } } } + post { + success { + setBuildStatus("Build succeeded", "SUCCESS"); + } + failure { + setBuildStatus("Build failed", "FAILURE"); + } + } } From 050eb7399f1640169f30aaf442b5a46b81915549 Mon Sep 17 00:00:00 2001 From: belly-rewardz Date: Thu, 30 May 2024 16:29:36 +0700 Subject: [PATCH 12/15] Add pending state --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 298defc..e2285ce 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,6 +33,7 @@ options { stage('Echo') { steps { container('node') { + setBuildStatus("Build in progress", "PENDING"); script { echo "hello world 2" sh "ls -lah" From 709b6281b62b1495172f1d017c578522bb8be300 Mon Sep 17 00:00:00 2001 From: belly-rewardz Date: Thu, 30 May 2024 16:31:18 +0700 Subject: [PATCH 13/15] edit --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index e2285ce..2a83628 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -35,7 +35,7 @@ options { container('node') { setBuildStatus("Build in progress", "PENDING"); script { - echo "hello world 2" + echo "hello world" sh "ls -lah" sh "pwd || true" } From ca6ad180675334005eeb2f13a55e5e5468fef7a0 Mon Sep 17 00:00:00 2001 From: belly-rewardz Date: Thu, 30 May 2024 16:35:46 +0700 Subject: [PATCH 14/15] use master agent --- Jenkinsfile | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2a83628..ab59625 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,19 +10,7 @@ void setBuildStatus(String message, String state) { pipeline { agent { - kubernetes { - yaml ''' -apiVersion: v1 -kind: Pod -spec: - containers: - - name: node - image: node:14.17.2 - command: ["/bin/sh"] - args: ["-c", "while true; do echo hello; sleep 10;done"] - serviceAccountName: analytics-sa -''' - } + label 'master' } options { ansiColor('xterm') @@ -32,14 +20,12 @@ options { stages { stage('Echo') { steps { - container('node') { - setBuildStatus("Build in progress", "PENDING"); - script { - echo "hello world" - sh "ls -lah" - sh "pwd || true" - } - } + setBuildStatus("Build in progress", "PENDING"); + script { + echo "hello world" + sh "ls -lah" + sh "pwd || true" + } } } } From 810e45729f030e2f6b1bb30410d10e883945b30d Mon Sep 17 00:00:00 2001 From: belly-rewardz Date: Thu, 30 May 2024 16:42:52 +0700 Subject: [PATCH 15/15] remove manual set commit status --- Jenkinsfile | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ab59625..bc7a96a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,12 +1,12 @@ -void setBuildStatus(String message, String state) { - step([ - $class: "GitHubCommitStatusSetter", - reposSource: [$class: "ManuallyEnteredRepositorySource", url: "https://github.com/belly-rewardz/webhook-trigger"], - contextSource: [$class: "ManuallyEnteredCommitContextSource", context: "ci/jenkins/build-status"], - errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]], - statusResultSource: [ $class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ] - ]); -} +// void setBuildStatus(String message, String state) { +// step([ +// $class: "GitHubCommitStatusSetter", +// reposSource: [$class: "ManuallyEnteredRepositorySource", url: "https://github.com/belly-rewardz/webhook-trigger"], +// contextSource: [$class: "ManuallyEnteredCommitContextSource", context: "ci/jenkins/build-status"], +// errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]], +// statusResultSource: [ $class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ] +// ]); +// } pipeline { agent { @@ -20,7 +20,7 @@ options { stages { stage('Echo') { steps { - setBuildStatus("Build in progress", "PENDING"); + // setBuildStatus("Build in progress", "PENDING"); script { echo "hello world" sh "ls -lah" @@ -29,12 +29,12 @@ options { } } } - post { - success { - setBuildStatus("Build succeeded", "SUCCESS"); - } - failure { - setBuildStatus("Build failed", "FAILURE"); - } - } + // post { + // success { + // setBuildStatus("Build succeeded", "SUCCESS"); + // } + // failure { + // setBuildStatus("Build failed", "FAILURE"); + // } + // } }