The PRs job will build PRs.
The non-PRs job will build the production website.
Signed-off-by: David Galloway <dgallowa@redhat.com>
--- /dev/null
+#!/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/
--- /dev/null
+- 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
## 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/
- 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
builders:
- shell:
!include-raw:
- - ../../../scripts/build_utils.sh
- ../../build/build