Remove CI staging.
Change-Id: I730d712336f0311532d7ee505f0ec7d5e9c6b286
diff --git a/README.md b/README.md
index 7dd65d5..342c14c 100644
--- a/README.md
+++ b/README.md
@@ -43,6 +43,5 @@
* [`vm.sh`](docs/machines.md): lets you control the machines
(e.g. start/stop them, create/delete/reimage them), including
the Jenkins controller and the executor nodes.
-* [workflow](docs/workflow.md): explains the CI workflow, and
- how you can test local changes with jenkins-staging
+* [workflow](docs/workflow.md): explains the CI workflow
* [jobs](docs/jobs.md): explains what jobs are running on the CI
diff --git a/docs/init.md b/docs/init.md
index 0fb672d..16d9d04 100644
--- a/docs/init.md
+++ b/docs/init.md
@@ -1,47 +1,33 @@
-# Initializing the Bazel CI
+# Initializing Google Cloud for Bazel's CI
-## Creating the project from scratch
+This document describes how to setup our Google Cloud project so that it can
+host Bazel's Jenkins CI.
-This operation can be __very dangerous__:
+## Network
-* it does not check for the disk existences
-* it can lead to formatting some disks
+For CI we're using a normal 'auto' mode network:
-Only create the project from scratch if you know what you're doing.
-
-### What to run
-
-Run:
-
-```
-./gce/init.sh init <instance>
+```bash
+gcloud compute networks create "default"
```
-Where `<instance>` is `prod` or `staging`.
+We'll also need a static IP address for Jenkins:
-The command:
-
-* creates the `/volumes` disk
-* creates the GCP Network
-* sets up the GCP Firewall Rules
-
-To regenerate the network rules:
-
+```bash
+gcloud compute addresses create "ci"
```
-./gce/init.sh firewall <instance>
-```
-
-Note: the Bazel CI's own firewall rules are managed automatically by GCP.
-
-After this command, you can populate the `/volumes` disk of the Jenkins
-controllers ("masters"). There's one controller for each `<instance>`, i.e.
-there's a prod controller and a staging controller.
## `/volumes` disk
The Jenkins controller is connected to a persistent disk. This disk is
encrypted, and it is not erased between builds nor after Jenkins restarts.
+Let's create one:
+
+```bash
+gcloud compute disks create "jenkins-volumes" --size=4TB
+```
+
This disk is mounted under `/volumes` on the Jenkins controller and has two
subdirectories:
@@ -70,8 +56,8 @@
```text
Application type: Web application
- Name: Jenkins-staging
- Authorized redirect URIs: https://ci-staging.bazel.build/securityRealm/finishLogin
+ Name: Jenkins
+ Authorized redirect URIs: https://ci.bazel.build/securityRealm/finishLogin
```
3. Click create, copy the resulting Client ID and Client secret into the
@@ -94,7 +80,7 @@
1. Run the local, testing instance of Jenkins:
```sh
- bazel run //jenkins:test [-- -p <port>]
+ bazel run //jenkins/test [-- -p <port>]
```
This deploys some Docker images on your local machine and starts a
@@ -165,12 +151,11 @@
* `apt-key.id` and `apt-key.sec.gpg`: GPG key to sign the Debian packages
* `smtp.auth.password` and `smtp.auth.username`: authentication information
- for the mail provider
+ for the mail provider.
- We use a jenkins-only identifier to send emails through
- [SendGrid](https://sendgrid.com).
+ We use bazel.build's G Suite to send e-mails.
## Next
-You can now use the [`vm.sh` script to manipulate the Virtual Machines and
-the `setup_mac.sh` script to setup mac nodes](machines.md).
+You can now use the [`vm.sh` script to create the virtual machines and the
+`setup_mac.sh` script to setup mac nodes](machines.md).
diff --git a/docs/jobs.md b/docs/jobs.md
index 3f83dd5..9da26b4 100644
--- a/docs/jobs.md
+++ b/docs/jobs.md
@@ -35,10 +35,7 @@
The job templates and definitions are under `//jenkins`.
Particularly interesting is `//jenkins/jobs/jobs.bzl`: it contains the logic
-that computes which jobs to run on the prod CI and on the staging CI.
-
-On the staging CI we run fewer jobs than on the prod one, to make full builds
-faster.
+that computes which jobs to run on CI.
## Hidden jobs
diff --git a/docs/machines.md b/docs/machines.md
index 035cd27..fd1ab57 100644
--- a/docs/machines.md
+++ b/docs/machines.md
@@ -16,15 +16,14 @@
* Docker containers (e.g. the deploy node that deploys Bazel releases and the
Bazel homepage)
- The Docker containers run on the Jenkins controller's VM.
+The Docker containers run on the Jenkins controller's VM.
## Administration
* VMs: through the `//gce/vm.sh` script
* Physical machines: physically or through Chrome Remote Desktop
-* Docker containers: through the `//gce/jenkins.yml` and
- `//gce/jenkins-staging.yml` files (Google Container Engine pod
- configurations)
+* Docker containers: through the `//gce/jenkins.yml` files (Google Container
+ Engine pod configurations)
### Virtual machines admininstration
@@ -33,8 +32,7 @@
You can apply the script's changes to:
* individual machines, or
-* all machines, or
-* all machines from `staging` or `prod` instance
+* all machines
`//gce/vm.sh` script commands:
@@ -42,9 +40,6 @@
it
* `reimage`: `delete` a machine, then `create` it again
* `start` and `stop`: start or stop the specified machine(s).
-
- We typically use this to shut down the staging instance.
-
* `update_metadata`: update the metadata for the VM
The metadata is what we pass to the `--metadata` flags when we run `gcloud
diff --git a/docs/workflow.md b/docs/workflow.md
index 0514c36..d81100e 100644
--- a/docs/workflow.md
+++ b/docs/workflow.md
@@ -1,9 +1,5 @@
# Bazel CI workflow
-**Note:** the first bazel build is going to stall for some time while
-building the base images on docker without any output due to
-[bazelbuild/bazel#1289](https://github.com/bazelbuild/bazel/issues/1289).
-
## Prerequisites
Docker:
@@ -11,10 +7,10 @@
* [At least
25GB](https://github.com/bazelbuild/continuous-integration/issues/73) of
free disk space.
+
* Your username in the "docker" group.
- Follow the instructions on [Ask
- Ubuntu](https://askubuntu.com/a/477554/671928).
+ Follow the instructions on [Ask Ubuntu](https://askubuntu.com/a/477554/671928).
Gcloud:
@@ -23,39 +19,26 @@
```
gcloud auth login
gcloud config set project bazel-public
+ gcloud config set zone europe-west1-d
```
## Pushing changes
-The typical worflow when modfiying ci.bazel.build is to first test the
-change on ci-staging.bazel.build.
-
The process typically looks like:
-1. Make your change
-2. Add a few jobs to test to [`jenkins/jobs/jobs.bzl`](jobs.md).
-3. Start the staging Jenkins instance with [`./gce/vm.sh start staging`](vm.md).
-4. Run `bazel run //gcr:deploy-staging` to deploy the change to
- the staging instance.
-5. Restart the staging Jenkins instance by going to
- https://ci-staging.bazel.build/safeExit .
-6. Run a job by identifying it on [https://ci-staging.bazel.build] and
- clicking on the play button.
-7. If 6 fails, go back to 1, skipping step 3.
-8. Send the change to review.
-9. Shut down the staging Jenkins instance with [`./gce/vm.sh stop staging`](vm.md).
-10. Once LGTM, deploy to production with `bazel run //gcr:deploy`.
-11. Restart the prod Jenkins instance: https://ci.bazel.build/safeExit
+1. Make your change.
+2. Deploy to production with `bazel run //gcr:deploy`.
+3. Gracefully restart the Jenkins instance: https://ci.bazel.build/safeExit
- You need to log in to the Jenkins UI, otherwise you may get a stack trace.
- Log in and try again.
+ If Jenkins doesn't exit fast enough, ensure that no important jobs are
+ running and then: https://ci.bazel.build/exit
## Setting up local testing
You can run a local Jenkins instance with a Docker executor node, by running:
```
-bazel run //jenkins:test [-- -p port]
+bazel run //jenkins/test [-- -p port]
```
It will spin up a Jenkins instance:
@@ -66,7 +49,7 @@
This setup should suffice for local testing.
-To stop the instance, go to `http://localhost:8080/safeExit`. This will shut
+To stop the instance, go to `http://localhost:8080/exit`. This will shut
down Jenkins cleanly.
You can connect additional instance by modifying the UI to test for other
@@ -81,38 +64,15 @@
If you only need to modify Groovy code under `jenkins/lib`, you can update that
in the running container without restarting Jenkins.
-### If you test with a local container
-
-1. start the container
+1. Start the container:
```
- bazel run //jenkins:test
+ bazel run //jenkins/test
```
-2. make your changes to `.groovy` files
-3. transfor the `lib` folder to the running container:
+2. Make your changes to `.groovy` files.
+3. Transfer the `lib` folder to the running container:
```
jenkins/transfer-lib.sh
```
-
-### If you test with the staging Jenkins instance
-
-1. start the instance
-
- ```
- gce/vm.sh start staging
- ```
-
-2. make your changes to `.groovy` files
-3. transfor the `lib` folder to the container running on the staging instance
-
- ```
- jenkins/transfer-lib-to-staging.sh
- ```
-
-4. stop the instance when done
-
- ```
- gce/vm.sh stop staging
- ```
diff --git a/gce/init.sh b/gce/init.sh
deleted file mode 100755
index fb0cab5..0000000
--- a/gce/init.sh
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/bin/bash
-#
-# Copyright 2015 The Bazel Authors. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Script to create the GCE setup for ci.bazel.build and ci-staging.bazel.build
-# from scratch.
-set -eu
-
-# Each line contains: NAME NETWORK ADDRESS_NAME DISK_NAME restrict_http
-SYSTEMS=(
- "prod default ci jenkins-volumes false"
- "staging staging ci-staging jenkins-volumes-staging true"
-)
-
-cd "$(dirname "${BASH_SOURCE[0]}")"
-
-source utils/commands.sh
-source utils/network.sh
-source utils/create_disk.sh
-
-function test_name() {
- local search="$1"
- local match="$2"
- if [ "$search" == "$match" ]; then
- return 0
- else
- return 1
- fi
-}
-
-function action() {
- local action=$1
- shift
- if (( $# == 0 )); then
- for i in "${SYSTEMS[@]}"; do
- $action $i
- done
- else
- local name="$1"
- shift
- for j in "${SYSTEMS[@]}"; do
- if test_name "$name" $j; then
- $action $j "$@"
- fi
- done
- fi
-}
-
-function create() {
- local name="$1"
- local network="$2"
- local ip_address="$3"
- local disk_name="$4"
- local restrict_http="$5"
- shift 5
- echo "[*] Creating disk ${disk_name}"
- create_disk "${disk_name}"
- echo "[*] Creating static IP address ${ip_address}"
- gcloud compute addresses create "${ip_address}"
- echo "[*] Creating cloud network ${network}"
- create_network "${network}"
- echo "[*] Setting-up firewall rules for ${network}"
- setup_firewall "${network}" "${restrict_http}" "${@}"
- echo "[*] Creating VMs for ${name}"
- ./vm.sh create "${name}"
-}
-
-function reset_firewall() {
- local name="$1"
- local network="$2"
- local ip_address="$3"
- local disk_name="$4"
- local restrict_http="$5"
- shift 5
- echo "[*] Setting-up firewall rules for ${network}"
- setup_firewall "${network}" "${restrict_http}" "${@}"
-}
-
-function usage() {
- echo "Usage: $0 (init|firewall) (staging|prod) [restricted_ip_ranges]" >&2
- exit 1
-}
-
-if (( $# < 2 )); then
- usage
-fi
-
-command="${1-}"
-shift || true
-
-case "${command}" in
- "init")
- echo "*** WARNING ***"
- echo "This is a risky operation as it will create ips and network without"
- echo "checking for its existence. It will also overwrite the firewall rules."
- echo -n "Are you sure you want to do that? [y/N] "
- read ans
- [ "$ans" = "y" ] || [ "$ans" = "Y" ] || exit 1
- action create "$@"
- ;;
- "firewall")
- action reset_firewall "$@"
- ;;
- *)
- usage
- ;;
-esac
diff --git a/gce/jenkins-staging.yml b/gce/jenkins-staging.yml
deleted file mode 100644
index 4aa9c3f..0000000
--- a/gce/jenkins-staging.yml
+++ /dev/null
@@ -1,44 +0,0 @@
-apiVersion: v1
-kind: Pod
-metadata:
- name: jenkins-staging
-spec:
- containers:
- - name: jenkins-master-staging
- image: gcr.io/bazel-public/jenkins-master-staging
- imagePullPolicy: Always
- volumeMounts:
- - name: jenkins-home
- mountPath: /var/jenkins_home
- readOnly: false
- - name: secrets
- mountPath: /opt/secrets
- readOnly: true
- ports:
- - name: www
- containerPort: 8080
- hostPort: 80
- protocol: TCP
- - name: jenkins-slave
- containerPort: 50000
- hostPort: 50000
- protocol: TCP
- - name: deploy-slave-staging
- image: gcr.io/bazel-public/deploy-slave-staging
- imagePullPolicy: Always
- env:
- - name: JENKINS_SERVER
- value: jenkins-staging
- volumeMounts:
- - name: secrets
- mountPath: /opt/secrets
- readOnly: true
- restartPolicy: Always
- dnsPolicy: Default
- volumes:
- - name: jenkins-home
- hostPath:
- path: /volumes/jenkins_home
- - name: secrets
- hostPath:
- path: /volumes/secrets
diff --git a/gce/utils/create_disk.sh b/gce/utils/create_disk.sh
deleted file mode 100644
index 666fd6f..0000000
--- a/gce/utils/create_disk.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-#
-# Copyright 2015 The Bazel Authors. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Creates an empty E2FS disk on GCE
-set -eu
-
-function create_disk() {
- local name="$1"
- local zone="${2:-$(gcloud config list compute/zone | grep zone | sed -E 's/ *zone *= *([^ ]*) */\1/')}"
- size="${3:-1024GB}"
-
- log "Creating disk ${name}"
- gcloud compute disks create "${name}" --size="${size}" --zone="${zone}"
-
- log "Creating a VM temp-create-disk-${name} for formatting disk ${name}"
- gcloud compute instances create "temp-create-disk-${name}" --zone="${zone}" \
- --image ubuntu-14-04 --boot-disk-type pd-ssd \
- --machine-type n1-standard-1 --disk "name=${name},device-name=volumes"
- # Wait for the VM to be up and running
- wait_vm "temp-create-disk-${name}" "${zone}"
- log "Formatting disk ${name} on temp-create-disk-${name}"
- ssh_command "temp-create-disk-${name}" "${zone}" \
- "yes | mkfs.ext4 -t ext4 /dev/disk/by-id/google-volumes"
- log "Deleting VM temp-creat-disk-${name}"
- echo y | gcloud compute instances delete --zone "${zone}" "temp-create-disk-${name}"
-}
-
diff --git a/gce/utils/network.sh b/gce/utils/network.sh
deleted file mode 100644
index 1d20a5b..0000000
--- a/gce/utils/network.sh
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/bin/bash
-#
-# Copyright 2015 The Bazel Authors. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This script defines functions to manipulate GCP networks.
-set -eu
-
-# Create a network $1
-function create_network() {
- local name="$1"
- gcloud compute networks create "${name}" \
- --mode=legacy --range="192.168.59.0/24"
-}
-
-# Setup the firewall for network $1, allowing all ip ranges in ${3}..${$#}.
-# If ${2} is set to true, HTTP request will also be restricted by these ranges.
-# Each value in the list of ip ranges is a comma separated ip range, that will
-# create a corresponding network rule.
-function setup_firewall() {
- local network="$1"
- shift 1
- local restrict_http="${1:-false}"
- shift 1 || true
- local restrict_ips=("${@}")
- if (( $# == 0 )); then
- restrict_ips=("0.0.0.0/0") # Allow everybody
- fi
-
- log "Removing all existing rules from network ${network}"
- local rules="$(gcloud compute firewall-rules list \
- | awk '$2 ~ /'"${network}"'/ {print $1}')"
- if [ -n "${rules}" ]; then
- gcloud compute firewall-rules delete ${rules}
- fi
-
- log "Allowing internal TCP, UDP and ICMP traffic inside network ${network}"
- gcloud compute firewall-rules create "${network}-allow-internal" \
- --network="${network}" --allow="tcp,udp,icmp" \
- --source-ranges="192.168.0.0/16,172.16.0.0/12,10.0.0.0/8" \
- --description="Allow all TCP, UDP and ICMP traffic between machines on the '${network}' network"
-
- log "Enabling incoming HTTP(S) and ICMP traffic to the Jenkins master for network ${network}"
- local counter=0
- if $restrict_http; then
- for i in "${restrict_ips[@]}"; do
- counter=$((counter+1))
- gcloud compute firewall-rules create "${network}-allow-http-https-icmp-${counter}" \
- --network="${network}" \
- --allow="tcp:80,udp:80,tcp:443,udp:443,icmp" \
- --target-tags="jenkins" \
- --source-ranges="$i" \
- --description="Allow HTTP(S) connections and ICMP to Jenkins web interface"
- done
- else
- gcloud compute firewall-rules create "${network}-allow-http-https-icmp" \
- --network="${network}" \
- --allow="tcp:80,udp:80,tcp:443,udp:443,icmp" \
- --target-tags="jenkins" \
- --source-ranges=0.0.0.0/0 \
- --description="Allow HTTP(S) connections and ICMP to Jenkins web interface"
- fi
-
- log "Enabling incoming SSH, RDP, Jenkins-API and ICMP traffic to VMs for network ${network}"
- counter=0
- for i in "${restrict_ips[@]}"; do
- counter=$((counter+1))
- gcloud compute firewall-rules create "${network}-allow-ssh-rdp-jenkins-icmp-${counter}" \
- --network="${network}" \
- --allow=tcp:22,tcp:3389,tcp:50000,icmp \
- --source-ranges=$i \
- --description="Allow SSH, RDP, Jenkins-API and ICMP"
- done
-}
diff --git a/gce/vm.sh b/gce/vm.sh
index 62926c3..5632f55 100755
--- a/gce/vm.sh
+++ b/gce/vm.sh
@@ -72,33 +72,14 @@
"ci-instance-group"
)
-# Executor nodes for ci-staging.bazel.build
-STAGING_SLAVES=(
- "ubuntu-14-04-slave-staging ubuntu-1404-lts ubuntu_14.04-x86_64-staging europe-west1-d staging startup-script=jenkins-slave.sh ubuntu-14-04-slave.sh bootstrap-bazel.sh linux-android.sh cleanup-install.sh"
- "ubuntu-16-04-slave-staging ubuntu-1604-lts ubuntu_16.04-x86_64-staging europe-west1-d staging startup-script=jenkins-slave.sh ubuntu-16-04-slave.sh bootstrap-bazel.sh linux-android.sh cleanup-install.sh"
- "ubuntu-docker-slave-staging ubuntu-1604-lts ubuntu_16.04-x86_64-docker-staging europe-west1-d default startup-script=jenkins-slave.sh ubuntu-16-04-slave.sh ubuntu-16-04-docker.sh bootstrap-bazel.sh linux-android.sh cleanup-install.sh"
- "freebsd-11-slave-staging https://www.googleapis.com/compute/v1/projects/freebsd-org-cloud-dev/global/images/freebsd-11-1-stable-amd64-2017-12-28 freebsd-11-staging europe-west1-d staging startup-script=jenkins-slave.sh freebsd-slave.sh freebsd-ci-homedir.sh"
- "freebsd-12-slave-staging https://www.googleapis.com/compute/v1/projects/freebsd-org-cloud-dev/global/images/freebsd-12-0-current-amd64-2017-12-28 freebsd-12-staging europe-west1-d staging startup-script=jenkins-slave.sh freebsd-slave.sh freebsd-ci-homedir.sh"
- # Fow Windows, we use a custom image with pre-installed MSVC.
- "windows-slave-staging windows-server-2016-dc-bazel-ci-v20180115 windows-x86_64-staging europe-west1-d staging windows-startup-script-ps1=jenkins-slave-windows-2016.ps1"
- # Remote Cache
- "remote-cache-staging ubuntu-1604-lts remote-cache-staging europe-west1-d staging startup-script=start-remote-cache.sh setup-remote-cache.sh"
-)
-STAGING_MASTER=(
- # VM name
- "jenkins-staging"
- # Zone
- "europe-west1-d"
- # Metadata specification
- "google-container-manifest=jenkins-staging.yml,startup-script=mount-volumes.sh"
- # Disk specification
- "name=jenkins-volumes-staging,device-name=volumes"
- # Address name
- "ci-staging"
- # Network name
- "staging"
- # Instance group
- "ci-staging-instance-group"
+# You can use these VMs to test anything you want on this platform. They are not
+# connected to Jenkins.
+TESTING=(
+ "ubuntu-14-04-testing ubuntu-1404-lts ubuntu_14.04-x86_64-testing europe-west1-d testing ubuntu-14-04-slave.sh bootstrap-bazel.sh linux-android.sh cleanup-install.sh"
+ "ubuntu-16-04-testing ubuntu-1604-lts ubuntu_16.04-x86_64-testing europe-west1-d testing ubuntu-16-04-slave.sh bootstrap-bazel.sh linux-android.sh cleanup-install.sh"
+ "freebsd-11-testing https://www.googleapis.com/compute/v1/projects/freebsd-org-cloud-dev/global/images/freebsd-11-1-stable-amd64-2017-12-28 freebsd-11-testing europe-west1-d testing freebsd-slave.sh freebsd-ci-homedir.sh"
+ "freebsd-12-testing https://www.googleapis.com/compute/v1/projects/freebsd-org-cloud-dev/global/images/freebsd-12-0-current-amd64-2017-12-28 freebsd-12-testing europe-west1-d testing freebsd-slave.sh freebsd-ci-homedir.sh"
+ "windows-testing windows-server-2016-dc-bazel-ci-v20180115 windows-x86_64-testing europe-west1-d testing"
)
cd "$(dirname "${BASH_SOURCE[0]}")"
@@ -142,7 +123,7 @@
local STARTUP_METADATA="$6"
shift 6
- if [[ $TAG == *-staging ]]; then
+ if [[ $TAG == *-testing ]]; then
MACHINE_TYPE="n1-standard-8"
BOOT_DISK_SIZE="250GB"
else
@@ -216,12 +197,7 @@
local location="${MASTER[1]}"
local startup_metadata="${MASTER[2]}"
- if [ "$1" = "jenkins-staging" ]; then
- tag="${STAGING_MASTER[0]}"
- metadata_flag=""
- location="${STAGING_MASTER[1]}"
- startup_metadata="${STAGING_MASTER[2]}"
- elif [ ! "$1" = jenkins ]; then
+ if [ ! "$1" = jenkins ]; then
local args="$(get_slave_by_name "$1")"
[ -n "$args" ] || (echo "Unknown vm $1" >&2; exit 1)
@@ -238,7 +214,7 @@
}
function get_slave_by_name() {
- for i in "${SLAVES[@]}" "${STAGING_SLAVES[@]}"; do
+ for i in "${SLAVES[@]}" "${TESTING[@]}"; do
if [[ "$i" =~ ^"$1 " ]]; then
echo "$i"
fi
@@ -248,8 +224,6 @@
function create_vm() {
if [ "$1" = "jenkins" ]; then
create_master "${MASTER[@]}"
- elif [ "$1" = "jenkins-staging" ]; then
- create_master "${STAGING_MASTER[@]}"
else
local args="$(get_slave_by_name "$1")"
[ -n "$args" ] || (echo "Unknown vm $1" >&2; exit 1)
@@ -262,20 +236,9 @@
shift
if (( $# == 0 )); then
$action jenkins
- $action jenkins-staging
- for i in "${SLAVES[@]}" "${STAGING_SLAVES[@]}"; do
- $action "${i%% *}"
- done
- elif (( $# == 1 )) && [ "$1" = "prod" ]; then
- $action jenkins
for i in "${SLAVES[@]}"; do
$action "${i%% *}"
done
- elif (( $# == 1 )) && [ "$1" = "staging" ]; then
- $action jenkins-staging
- for i in "${STAGING_SLAVES[@]}"; do
- $action "${i%% *}"
- done
else
for i in "$@"; do
$action "$i"
@@ -289,8 +252,6 @@
if test_vm $TAG; then
if [ "$TAG" = "${MASTER[0]}" ]; then
echo "${MASTER[1]}"
- elif [ "$TAG" = "${STAGING_MASTER[0]}" ]; then
- echo "${STAGING_MASTER[1]}"
else
get_slave_by_name "$TAG" | cut -d " " -f 4
fi
@@ -360,7 +321,7 @@
"ssh_command")
do_ssh_command "$@"
;;
- "vms")
+ "vms"|"list")
action print_vm_name "$@"
;;
"ssh")
@@ -377,7 +338,7 @@
do_ssh_command "$1" 'sudo docker stop $(sudo docker ps -q -f status=running -f ancestor='"$2"')'
;;
*)
- echo "Usage: $0 <command> ([<vm> ... <vm>]|staging|prod)" >&2
+ echo "Usage: $0 <command> ([<vm> ... <vm>])" >&2
echo " $0 ssh_command <vm> <arg0> [<arg1>..<argN>]" >&2
echo " $0 ssh <vm>" >&2
echo " $0 kill_container <vm> <image>" >&2
@@ -392,8 +353,8 @@
echo " - ssh launch a secure shell on the specified VM." >&2
echo " - kill_container kills container that runs the specified image on the" >&2
echo " specified VM." >&2
- echo "Special value 'staging' and 'prod' point to all VM in, respectively," >&2
- echo "ci-staging.bazel.build and ci.bazel.build." >&2
+ echo " Unless you specify a specific VM, this tool will operate on all VMs " >&2
+ echo " (Jenkins master and slaves)." >&2
exit 1
;;
esac
diff --git a/gcr/BUILD b/gcr/BUILD
index b61e9ae..e9e67c5 100644
--- a/gcr/BUILD
+++ b/gcr/BUILD
@@ -8,7 +8,7 @@
)
docker_bundle(
- name = "prod-bundle",
+ name = "bundle",
images = {
"gcr.io/bazel-public/jenkins-master:latest": "//jenkins:jenkins",
"gcr.io/bazel-public/deploy-slave:latest": "//jenkins:deploy.docker",
@@ -18,18 +18,5 @@
docker_push(
name = "deploy",
- bundle = ":prod-bundle",
-)
-
-docker_bundle(
- name = "staging-bundle",
- images = {
- "gcr.io/bazel-public/jenkins-master-staging:latest": "//jenkins:jenkins-staging",
- "gcr.io/bazel-public/deploy-slave-staging:latest": "//jenkins:deploy-staging.docker",
- },
-)
-
-docker_push(
- name = "deploy-staging",
- bundle = ":staging-bundle",
+ bundle = ":bundle",
)
diff --git a/jenkins/BUILD b/jenkins/BUILD
index 266e7e0..aea171b 100644
--- a/jenkins/BUILD
+++ b/jenkins/BUILD
@@ -142,16 +142,6 @@
tunnel = "jenkins.c.bazel-public.internal:50000",
)
-jenkins_node(
- name = "deploy-staging",
- docker_base = "deploy-full",
- labels = ["deploy"],
- # Deploy slave have special access, do not allow to get reserved by accident.
- mode = "EXCLUSIVE",
- num_executors = 2,
- visibility = ["//visibility:public"],
-)
-
docker_build(
name = "ubuntu-with-bazel-installer",
base = "//base:deploy-base",
@@ -160,16 +150,6 @@
files = ["//gce:bootstrap-bazel.sh"],
)
-jenkins_node(
- name = "ubuntu-docker",
- docker_base = ":ubuntu-with-bazel-installer",
- labels = [
- "linux-x86_64",
- "install-bazel",
- ],
- tunnel = "jenkins.c.bazel-public.internal:50000",
-)
-
# Jenkins job for Gerrit vetting
jenkins_job(
name = "maintenance/gerrit-verifier",
@@ -269,32 +249,17 @@
visibility = ["//visibility:public"],
)
-jenkins_docker_build(
- name = "jenkins-staging",
- configs = [
- ":config_xml",
- ":darwin-x86_64-staging",
- ":deploy-staging",
- ":freebsd-11-staging",
- ":jenkins-common-configs",
- ":ubuntu_14.04-x86_64-staging",
- ":ubuntu_16.04-x86_64-docker-staging",
- ":ubuntu_16.04-x86_64-staging",
- ":windows-x86_64-staging",
+# The Jenkins node used for testing on localhost via //jenkins/test.
+jenkins_node(
+ name = "ubuntu-docker",
+ docker_base = ":ubuntu-with-bazel-installer",
+ labels = [
+ "linux-x86_64",
+ "install-bazel",
],
- jobs = [
- "//jenkins/jobs:staging-jobs",
- ":maintenance/gerrit-verifier/staging",
- ],
- substitutions = {
- "PUBLIC_JENKINS_URL": "https://ci-staging.bazel.build/",
- },
- tars = ["//jenkins/lib"],
- visibility = ["//gcr:__pkg__"],
)
-#
-# A jenkins image for testing purpose
+# The Jenkins image used for testing on localhost via //jenkins/test.
jenkins_docker_build(
name = "jenkins-test",
configs = [
@@ -341,8 +306,3 @@
],
),
)
-
-alias(
- name = "test",
- actual = "//jenkins/test",
-)
diff --git a/jenkins/build_defs/jenkins_docker_build.bzl b/jenkins/build_defs/jenkins_docker_build.bzl
index 7e27bc2..2d3a892 100644
--- a/jenkins/build_defs/jenkins_docker_build.bzl
+++ b/jenkins/build_defs/jenkins_docker_build.bzl
@@ -53,7 +53,7 @@
_build_jobs = rule(
attrs = {
"jobs": attr.label_list(allow_files=True),
- "strip_suffixes": attr.string_list(default=["-staging", "-test"]),
+ "strip_suffixes": attr.string_list(default=["-test"]),
"_folder_xml": attr.label(
default=Label("//jenkins/build_defs:folder.xml"),
allow_files=True,
diff --git a/jenkins/build_defs/jenkins_job.bzl b/jenkins/build_defs/jenkins_job.bzl
index dc09f0a..ee4c948 100644
--- a/jenkins/build_defs/jenkins_job.bzl
+++ b/jenkins/build_defs/jenkins_job.bzl
@@ -37,11 +37,10 @@
project_url: the project url, defaulted to the Git URL
test_platforms: platforms on which to run that job when inside of a
dockerized test, by default only 'linux-x86_64'
- create_filegroups: create filegroups named <name>/all, <name>/staging
- and <name>/test that contains the files needed to be included
- to include that job respectively for the production service, the
- staging service and the docker test version. This is to be set
- to false is the calling macros already creates those filegroups.
+ create_filegroups: create filegroups named <name>/all and <name>/test that
+ contain the files that have to be included to include that job. This is
+ to be set to false if the calling macros already creates those
+ filegroups.
"""
github_project = "%s/%s" % (org, project)
github_url = "https://github.com/" + github_project
@@ -72,19 +71,6 @@
)
if create_filegroups:
native.filegroup(name = name + "/all", srcs = [name])
- substitutions["SEND_EMAIL"] = "0"
- substitutions["BAZEL_BUILD_RECIPIENT"] = ""
- substitutions["production"] = "false"
- expand_template(
- name = name + "-staging",
- template = config,
- out = "%s-staging.xml" % name,
- deps = deps,
- deps_aliases = deps_aliases,
- substitutions = substitutions,
- )
- if create_filegroups:
- native.filegroup(name = name + "/staging", srcs = [name + "-staging"])
if test_platforms:
substitutions["RESTRICT_CONFIGURATION"] += " + [node:%s]" % _to_groovy_list(test_platforms)
@@ -144,7 +130,6 @@
all_files = [name + ".xml"]
test_files = [name + "-test.xml"]
- staging_files = [name + "-staging.xml"]
kwargs = {}
if not github_enabled:
@@ -180,7 +165,6 @@
create_filegroups=False)
all_files.append("Global/%s.xml" % name)
test_files.append("Global/%s-test.xml" % name)
- staging_files.append("Global/%s-staging.xml" % name)
if pr_enabled and config:
jenkins_job(
@@ -197,7 +181,6 @@
create_filegroups=False)
all_files.append("PR/%s.xml" % name)
test_files.append("PR/%s-test.xml" % name)
- staging_files.append("PR/%s-staging.xml" % name)
if gerrit_project:
jenkins_job(
@@ -213,9 +196,7 @@
test_platforms=test_platforms)
all_files.append("CR/%s.xml" % name)
test_files.append("CR/%s-test.xml" % name)
- staging_files.append("CR/%s-staging.xml" % name)
native.filegroup(name = "%s/all" % name, srcs = all_files)
if test_platforms:
native.filegroup(name = "%s/test" % name, srcs = test_files)
- native.filegroup(name = "%s/staging" % name, srcs = staging_files)
diff --git a/jenkins/build_defs/jenkins_nodes.bzl b/jenkins/build_defs/jenkins_nodes.bzl
index 80a805f..223dc58 100644
--- a/jenkins/build_defs/jenkins_nodes.bzl
+++ b/jenkins/build_defs/jenkins_nodes.bzl
@@ -32,7 +32,6 @@
count,
labels=None,
prod_args=None,
- staging_args=None,
install_bazel=True,
**kwargs):
"""Create a set of Jenkins nodes on the system.
@@ -41,8 +40,7 @@
Example:
If `name` is `darwin-x86_64` and `count` is two, it will
- create two production nodes `darwin-x86_64-1` and
- `darwin-x86_64-2` and one staging node `darwin-x86_64-staging`.
+ create two production nodes `darwin-x86_64-1` and `darwin-x86_64-2`.
Args:
name: prefix of each node name, it should be the platform
@@ -52,8 +50,6 @@
the "install-bazel" label and the `name` itself).
prod_args: dictionary of aditional arguments for production only
nodes that will be passed to `jenkins_node`.
- staging_args: dictionary of aditional arguments for staging only
- nodes that will be passed to `jenkins_node`.
install_bazel: if the "install-bazel" label should be added to labels.
**kwargs: other arguments to be passed verbatim to `jenkins_node`.
"""
@@ -65,8 +61,3 @@
labels = labels,
**prod_kwargs
) for n in jenkins_node_names(name, count)]
- staging_kwargs = _extend_kwargs(kwargs, staging_args)
- jenkins_node(
- name = "%s-staging" % name,
- labels = labels,
- **staging_kwargs)
diff --git a/jenkins/build_defs/templates.bzl b/jenkins/build_defs/templates.bzl
index 8182fbd..43d151a 100644
--- a/jenkins/build_defs/templates.bzl
+++ b/jenkins/build_defs/templates.bzl
@@ -159,7 +159,7 @@
"template_extension": attr.string(default=".tpl"),
"directory": attr.string(default="/"),
"strip_prefixes": attr.string_list(default=[]),
- "strip_suffixes": attr.string_list(default=["-staging", "-test"]),
+ "strip_suffixes": attr.string_list(default=["-test"]),
"substitutions": attr.string_dict(default={}),
"path_format": attr.string(default="{path}"),
"_build_tar": attr.label(
diff --git a/jenkins/jobs/jobs.bzl b/jenkins/jobs/jobs.bzl
index 53288a9..ae91e8d 100644
--- a/jenkins/jobs/jobs.bzl
+++ b/jenkins/jobs/jobs.bzl
@@ -1,20 +1,8 @@
-def _is_staging(job):
- job_desc = native.existing_rule(job + "-staging")
- job_subs = job_desc["substitutions"]
- is_bazel = "PROJECT_NAME" in job_subs
- is_gerrit = "GERRIT_PROJECT" in job_subs and job_subs["GERRIT_PROJECT"] != ""
- # Take job with Gerrit review, or jobs that are not bazel jovbs
- is_gerrit_or_not_bazel = is_gerrit or not is_bazel
- # Gold jobs are some bazel job that we include for testing
- is_gold = job in ["TensorFlow", "Tutorial", "rules_k8s", "rules_python"]
- return (is_gold or is_gerrit_or_not_bazel)
-
-
def _is_testing(job):
- # We include all test but the docker ones (they needs access to the docker server).
+ # We include all test but the docker ones (because they need access to the
+ # Docker server).
return not "docker" in job and job != "continuous-integration"
-
def job_lists(name = "jobs", visibility = None):
jobs = native.existing_rules()
@@ -25,12 +13,6 @@
)
native.filegroup(
- name = "staging-" + name,
- srcs = [j for j in jobs if j.endswith("/staging") and _is_staging(j[:-8])],
- visibility = visibility,
- )
-
- native.filegroup(
name = "test-" + name,
srcs = [j for j in jobs if j.endswith("/test") and _is_testing(j[:-5])],
visibility = visibility,
diff --git a/jenkins/lib/vars/readConfiguration.groovy b/jenkins/lib/vars/readConfiguration.groovy
index 48099c2..791cdcb 100644
--- a/jenkins/lib/vars/readConfiguration.groovy
+++ b/jenkins/lib/vars/readConfiguration.groovy
@@ -52,7 +52,7 @@
// have access to secrets.
return BazelConfiguration.flattenConfigurations(
BazelConfiguration.parse(conf), config.get("restrict_configuration", [:]),
- ["node": ["deploy", "deploy-staging"]])
+ ["node": ["deploy"]])
} catch(Exception ex) {
error(filename != null ? "Failed to validate configuration (file was ${filename}): ${ex.message}"
: "Failed to validate default configuration: ${ex.message}")
diff --git a/jenkins/transfer-lib-to-staging.sh b/jenkins/transfer-lib-to-staging.sh
deleted file mode 100755
index b86c7fa..0000000
--- a/jenkins/transfer-lib-to-staging.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 The Bazel Authors
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# A simple wrapper around transfer-lib to execute it on the staging server
-# just run it and it should transfer the lib to jenkins staging.
-
-: "${JENKINS_SERVER:=jenkins-staging}"
-: "${JENKINS_ZONE:=europe-west2-a}"
-: "${IMAGE_NAME:=gcr.io/bazel-public/jenkins-master-staging}"
-
-cd "$(dirname "$0")"
-gcloud compute ssh "--zone=${JENKINS_ZONE}" "${JENKINS_SERVER}" \
- --command "mkdir -p lib"
-gcloud compute scp --recurse "--zone=${JENKINS_ZONE}" lib/{src,vars} "${JENKINS_SERVER}":lib
-gcloud compute scp "--zone=${JENKINS_ZONE}" transfer-lib.sh "${JENKINS_SERVER}":
-gcloud compute ssh "--zone=${JENKINS_ZONE}" "${JENKINS_SERVER}" \
- --command "sudo bash -c 'IMAGE_NAME=${IMAGE_NAME} ./transfer-lib.sh'"