jjb: Add dev_review_efficios-www
authorKienan Stewart <kstewart@efficios.com>
Fri, 1 Dec 2023 20:58:44 +0000 (15:58 -0500)
committerKienan Stewart <kstewart@efficios.com>
Fri, 1 Dec 2023 20:58:44 +0000 (15:58 -0500)
Change-Id: I3c73146fafa6a8a898daaeb67f5d5f4c821b1765
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
jobs/efficios-www.yaml
scripts/efficios-www/deploy.sh

index f4ab347c6eb0dc2b3242f163847d7fc566855240..8664ebb5909bbc12254677b0ddbabbde448545c0 100644 (file)
@@ -1,14 +1,29 @@
-- job:
+- defaults:
     name: efficios-www
     project-type: freestyle
-    defaults: global
     node: amd64-rootnode
 
+    builders:
+      - shell:
+          !include-raw: scripts/efficios-www/deploy.sh
+
     description: |
       This job is responsible for updating the efficios website.
 
       <p>Job is managed by Jenkins Job Builder.</p>
 
+    properties:
+      - build-discarder:
+          num-to-keep: 5
+    scm:
+      - git:
+          url: git@git.internal.efficios.com:efficios/efficios-www.git
+          credentials-id: f3c907b6-7485-49e1-afe1-4df24fac4ca1
+          basedir: ./
+          skip-tag: true
+          branches:
+            - master
+
     wrappers:
       - ansicolor
       - timestamps
         - file:
             credential-id: d023f830-9ab0-409f-b977-8cd0e1944dd5
             variable: HOST_PUBLIC_KEYS
+      - inject:
+          properties-content: |
+            DEPLOY_TARGET=deploy:prod
+
+- job:
+    name: dev_review_efficios-www
+    defaults: efficios-www
 
     properties:
       - build-discarder:
-          num-to-keep: 5
-
-    triggers:
-      - pollscm:
-          cron: "@hourly"
-
-    builders:
-      - shell:
-          !include-raw: scripts/efficios-www/deploy.sh
+          days-to-keep: 1
+      - throttle:
+          option: 'category'
+          categories:
+            - 'gerrit-build'
 
     scm:
       - git:
-          url: git@git.internal.efficios.com:efficios/efficios-www.git
+          url: ssh://jenkins@review.lttng.org:29418/efficios-www.git
           credentials-id: f3c907b6-7485-49e1-afe1-4df24fac4ca1
           basedir: ./
-          skip-tag: true
           branches:
-            - master
+            - '$GERRIT_REFSPEC'
+          refspec: 'refs/changes/*:refs/changes/*'
+          skip-tag: true
+
+    triggers:
+      - gerrit:
+          trigger-on:
+            - comment-added-event:
+                approval-category: 'CI-Build'
+                approval-value: 1
+          projects:
+            - project-compare-type: 'PLAIN'
+              project-pattern: 'efficios-www'
+              branches:
+                - branch-compare-type: 'PLAIN'
+                  branch-pattern: 'master'
+
+    wrappers:
+      - ansicolor
+      - timestamps
+      - credentials-binding:
+        - ssh-user-private-key:
+            credential-id: f3c907b6-7485-49e1-afe1-4df24fac4ca1
+            key-file-variable: KEY_FILE_VARIABLE
+            username-variable: USER_NAME_VARIABLE
+            passphrase-variable: PASSPHRASE_VARIABLE
+        - file:
+            credential-id: d023f830-9ab0-409f-b977-8cd0e1944dd5
+            variable: HOST_PUBLIC_KEYS
+      - inject:
+          properties-content: |
+            DEPLOY_TARGET=deploy:pre
+
+- job:
+    name: efficios-www
+    defaults: efficios-www
+
+    triggers:
+      - pollscm:
+          cron: "@hourly"
 
     publishers:
       - archive:
index 9f0fb1386b35002f10c4b500690533812f0ee373..389a3175f8020ecf05ec17313a53f937ef7ca57a 100644 (file)
@@ -37,6 +37,9 @@ print_header() {
     set -x
 }
 
+# Fail early if not set
+echo "Deploy target: ${DEPLOY_TARGET}"
+
 # Add ssh key for deployment
 cp "$HOST_PUBLIC_KEYS" ~/.ssh/known_hosts
 cp "$KEY_FILE_VARIABLE" ~/.ssh/id_rsa
@@ -84,5 +87,5 @@ else
 fi
 
 print_header "Deploy website"
-grunt deploy:prod --verbose
+grunt "${DEPLOY_TARGET}" --verbose
 # EOF
This page took 0.026049 seconds and 4 git commands to generate.