]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-website: Split job into two (PRs and main) 1869/head
authorDavid Galloway <dgallowa@redhat.com>
Wed, 7 Jul 2021 15:34:53 +0000 (11:34 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Wed, 7 Jul 2021 15:34:53 +0000 (11:34 -0400)
The PRs job will build PRs.

The non-PRs job will build the production website.

Signed-off-by: David Galloway <dgallowa@redhat.com>
ceph-website-prs/build/build [new file with mode: 0755]
ceph-website-prs/config/definitions/ceph-website-prs.yml [new file with mode: 0644]
ceph-website/build/build
ceph-website/config/definitions/ceph-website.yml

diff --git a/ceph-website-prs/build/build b/ceph-website-prs/build/build
new file mode 100755 (executable)
index 0000000..08b0d44
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash
+set -ex
+
+## TODO: Check if only the src/ dir changed and `exit 0` if only the ceph.io.git README or something else inconsequential changed.
+env
+
+BRANCH=$(echo $GIT_BRANCH | sed 's:.*/::')
+
+# https://docs.npmjs.com/cli/v7/commands/npm-ci
+npm ci
+
+npm run build:development
+
+if [ ! -d /opt/www/${BRANCH} ]; then
+  mkdir -p /opt/www/${BRANCH}
+fi
+
+rsync -av --delete-after dist/ /opt/www/${BRANCH}/
+
+# This just makes the last `echo` line not repeat
+{ set +x; } 2>/dev/null
+
+echo "Success!  This site is available at https://${BRANCH}.ceph.io."
+
+## TODO: Prune deleted branches from /opt/www/
diff --git a/ceph-website-prs/config/definitions/ceph-website-prs.yml b/ceph-website-prs/config/definitions/ceph-website-prs.yml
new file mode 100644 (file)
index 0000000..4efa717
--- /dev/null
@@ -0,0 +1,58 @@
+- job:
+    name: ceph-website-prs
+    description: This job builds PRs from github.com/ceph/ceph.io and serves them at $branch.ceph.io.
+    node: www
+    project-type: freestyle
+    defaults: global
+    quiet-period: 5
+    block-downstream: false
+    block-upstream: false
+    properties:
+      - build-discarder:
+          days-to-keep: 1
+          num-to-keep: 10
+          artifact-days-to-keep: -1
+          artifact-num-to-keep: -1
+      - github:
+          url: https://github.com/ceph/ceph.io
+
+    parameters:
+      - string:
+          name: sha1
+          description: "A pull request ID or branch, like 'origin/pr/72/head' or wip-blogpost1"
+
+    triggers:
+      - github-pull-request:
+          org-list:
+            - ceph
+          white-list:
+            - adamduncan
+            - Pete-Robelou
+          cancel-builds-on-update: true
+          trigger-phrase: 'jenkins test.*|jenkins retest.*'
+          only-trigger-phrase: false
+          github-hooks: true
+          permit-all: false
+          auto-close-on-fail: false
+          status-context: "Compiling site"
+          started-status: "Compiling site"
+          success-status: "Site compiled successfully!"
+          failure-status: "Site compilation failed"
+#         This is kinda noisy if there's lots of force pushes
+#         success-comment: "Site built successfully!  https://${GIT_BRANCH}.ceph.io"
+
+    scm:
+      - git:
+          url: https://github.com/ceph/ceph.io
+          branches:
+            - origin/pr/${ghprbPullId}/merge
+          refspec: +refs/pull/${ghprbPullId}/*:refs/remotes/origin/pr/${ghprbPullId}/*
+          browser: auto
+          skip-tag: true
+          timeout: 20
+          wipe-workspace: true
+
+    builders:
+      - shell:
+          !include-raw:
+            - ../../build/build
index e8a8a8b3384bfb3203702f9cc2760a2148260369..3b8cc53ebb9d125d1ed8ed5938987d77f09f4b63 100755 (executable)
@@ -4,25 +4,12 @@ set -ex
 ## TODO: Check if only the src/ dir changed and `exit 0` if only the ceph.io.git README or something else inconsequential changed.
 env
 
-BRANCH=$(echo $GIT_BRANCH | sed 's:.*/::')
-
 npm install
 
-if [ "$BRANCH" == "main" ]; then
-  npm run build:production
-else
-  npm run build:development
-fi
+npm run build:production
 
-if [ ! -d /opt/www/${BRANCH} ]; then
-  mkdir -p /opt/www/${BRANCH}
+if [ ! -d /opt/www/main ]; then
+  mkdir -p /opt/www/main
 fi
 
-rsync -av --delete-after dist/ /opt/www/${BRANCH}/
-
-# This just makes the last `echo` line not repeat
-{ set +x; } 2>/dev/null
-
-echo "Success!  This site is available at https://${BRANCH}.ceph.io."
-
-## TODO: Prune deleted branches from /opt/www/
+rsync -av --delete-after dist/ /opt/www/main/
index 89d134de39d9c45e458013e622d47c7f928772df..24e2c2ef7a55595708afbfe8bc00dfec139c31e9 100644 (file)
@@ -1,6 +1,6 @@
 - job:
     name: ceph-website
-    description: This job builds branches from github.com/ceph/ceph.io and updates the website accordingly.
+    description: This job builds the main branch of https://github.com/ceph/ceph.io and keeps the website up to date
     node: www
     project-type: freestyle
     defaults: global
       - github:
           url: https://github.com/ceph/ceph.io
 
-    parameters:
-      - string:
-          name: sha1
-          description: "A pull request ID or branch, like 'origin/pr/72/head' or wip-blogpost1"
-
     triggers:
       - github
-      - github-pull-request:
-          org-list:
-            - ceph
-          white-list:
-            - adamduncan
-            - Pete-Robelou
-          cancel-builds-on-update: true
-          trigger-phrase: 'jenkins test.*|jenkins retest.*'
-          only-trigger-phrase: false
-          github-hooks: true
-          permit-all: false
-          auto-close-on-fail: false
-          status-context: "Compiling site"
-          started-status: "Compiling site"
-          success-status: "Site compiled successfully!"
-          failure-status: "Site compilation failed"
-#         This is kinda noisy if there's lots of force pushes
-#         success-comment: "Site built successfully!  https://${GIT_BRANCH}.ceph.io"
 
     scm:
       - git:
           url: https://github.com/ceph/ceph.io
           branches:
             - main
-            - origin/pr/${ghprbPullId}/merge
-          refspec: +refs/pull/${ghprbPullId}/*:refs/remotes/origin/pr/${ghprbPullId}/*
           browser: auto
           skip-tag: true
           timeout: 20
@@ -57,5 +32,4 @@
     builders:
       - shell:
           !include-raw:
-            - ../../../scripts/build_utils.sh
             - ../../build/build