diff --git a/README.md b/README.md index 5b6b4b5725b..34c007b7b2a 100644 --- a/README.md +++ b/README.md @@ -137,21 +137,6 @@ Must set env vars `DOCKER_USER` and `DOCKER_PASSWORD` or have a valid `.dockercf ./build-docker-push.sh ``` -### Jenkins automation - -Master branch: - -* Runs a build, pushes an image to Quay tagged with the commit sha - -Pull requests: - -* Runs a build when PRs are created or PR commits are pushed -* Comment with `Jenkins rebuild` to manually trigger a re-build -* Comment with `Jenkins push` to push an image to Quay, tagged with: - `pr_[pr #]_build_[jenkins build #]` - -If changes are ever required for the Jenkins job configuration, apply them to both the [regular console job](https://jenkins-tectonic.prod.coreos.systems/job/console-build/) and [PR image job](https://jenkins-tectonic.prod.coreos.systems/job/console-pr-image/). - ## Hacking See [CONTRIBUTING](CONTRIBUTING.md) for workflow & convention details. diff --git a/frontend/integration-tests/protractor.conf.ts b/frontend/integration-tests/protractor.conf.ts index 82b6b2c1ac9..bb0668a0edb 100644 --- a/frontend/integration-tests/protractor.conf.ts +++ b/frontend/integration-tests/protractor.conf.ts @@ -7,6 +7,8 @@ import * as _ from 'lodash'; import { TapReporter } from 'jasmine-reporters'; import * as ConsoleReporter from 'jasmine-console-reporter'; import * as failFast from 'protractor-fail-fast'; +import { createWriteStream} from 'fs'; +import { format } from 'util'; const tap = !!process.env.TAP; @@ -56,23 +58,12 @@ export const config: Config = { } }, onComplete: async() => { - console.log('BEGIN BROWSER LOGS'); + const consoleLogStream = createWriteStream('gui_test_screenshots/browser.log', { flags: 'a' }); browserLogs.forEach(log => { const {level, message} = log; const messageStr = _.isArray(message) ? message.join(' ') : message; - switch (level.name) { - case 'DEBUG': - console.log(level, messageStr); - break; - case 'SEVERE': - console.warn(level, messageStr); - break; - case 'INFO': - default: - console.info(level, messageStr); - } + consoleLogStream.write(`${format.apply(null, [`[${level.name}]`, messageStr])}\n`); }); - console.log('END BROWSER LOGS'); // Use projects if OpenShift so non-admin users can run tests. We need the fully-qualified name // since we're using kubectl instead of oc. diff --git a/jenkins b/jenkins deleted file mode 100755 index 6a5fbf91a63..00000000000 --- a/jenkins +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -# This is a transitional file. Remove it once Jenkins is updated and all old PRs are merged or closed -./jenkins.sh diff --git a/jenkins.sh b/jenkins.sh deleted file mode 100755 index 4ee5d22cf31..00000000000 --- a/jenkins.sh +++ /dev/null @@ -1,153 +0,0 @@ -#!/usr/bin/env bash - -set -eo pipefail - -# This script contains all jenkins work. -# This runs directly on the jenkins build host. -# The Jenkins build command should do nothing but execute this script. - -CURRENT_USER=$(whoami) -CURRENT_UID=$(id -u "$CURRENT_USER") -echo "Running under user: $CURRENT_USER, with uid: $CURRENT_UID" - -# We assume the jenkins jenkins user with uid 1000 on all build hosts -export BUILDER_RUN_USER=1000 - -if [ ${BUILDER_RUN_USER} -eq "${CURRENT_UID}" ]; then - echo "Running under User: ${CURRENT_USER}, with UID: ${CURRENT_UID}" -else - echo "Expected to run with UID: ${BUILDER_RUN_USER}, instead UID is: ${CURRENT_UID}. Fix Jenkins and try again." - exit 1 -fi - -S3_BUCKET="teamui-jenkins" -S3_URL="https://s3.amazonaws.com/$S3_BUCKET/" - -status() { - # Hide output so we don't leak creds in Jenkins log - set +x - description=${3:-"$1 $2."} - data=$(cat << EOF -{ - "context": "$1", - "state": "$2", - "description": "${description}", - "target_url": "${S3_URL}${BUILD_TAG}/${1}.log" -} -EOF -) - # TODO: use correct target url for performance status - # "target_url": "${BUILD_URL}console" - # shellcheck disable=SC2154 - curl -o /dev/null --silent -X POST --user "${GITHUB_CREDENTIALS}" \ - --data "$data" \ - "https://api.github.com/repos/openshift/console/statuses/${ghprbActualCommit}" - set -x -} - -s3_upload () { - # Hide output so we don't leak creds in Jenkins log - set +x - file=$1 - dest=$2 - content_type='text/plain' - datetime=$(TZ=utc date +"%a, %d %b %Y %T %z") - acl="x-amz-acl:public-read" - body="PUT\n\n${content_type}\n${datetime}\n${acl}\n/${S3_BUCKET}/${dest}" - signature=$(echo -en "${body}" | openssl sha1 -hmac "${AWS_SECRET_ACCESS_KEY}" -binary | base64) - - curl -o /dev/null --silent -X PUT -T "${file}" \ - -H "Host: ${S3_BUCKET}.s3.amazonaws.com" \ - -H "Date: ${datetime}" \ - -H "Content-Type: ${content_type}" \ - -H "${acl}" \ - -H "Authorization: AWS ${AWS_ACCESS_KEY_ID}:${signature}" \ - "https://${S3_BUCKET}.s3.amazonaws.com/${dest}" - set -x -} - - -builder_run () { - name=$1 - shift - needs_kubeconfig=$1 - shift - cmd=$* - - status "$name" 'pending' - - if [ "$needs_kubeconfig" -ne 0 ] - then - export DOCKER_ENV="KUBECONFIG" - fi - - mkdir -p jenkins-logs - # shellcheck disable=SC2086 - if ./builder-run.sh $cmd 2>&1 | tee "jenkins-logs/$name.log" - then - status "$name" 'success' - s3_upload "jenkins-logs/$name.log" "$BUILD_TAG/$name.log" - else - status "$name" 'error' - s3_upload "jenkins-logs/$name.log" "$BUILD_TAG/$name.log" - exit 1 - fi - unset DOCKER_ENV -} - -set -x -./clean.sh - -set +e - -builder_run 'Build' 0 ./build.sh -builder_run 'Tests' 0 ./test.sh -builder_run 'GUI-Tests' 1 ./test-gui.sh crud -builder_run 'GUI-Tests-New-App' 1 ./test-gui.sh newApp -builder_run 'GUI-Tests-OLM' 1 ./test-gui.sh olm -builder_run 'GUI-Tests-Service-Catalog' 1 ./test-gui.sh serviceCatalog - -status 'Performance' 'pending' -if DOCKER_ENV="KUBECONFIG" ./builder-run.sh ./test-gui.sh performance -then - description=$(cat ./frontend/gui_test_screenshots/bundle-analysis.txt) - status 'Performance' 'success' "${description}" -else - description=$(cat ./frontend/gui_test_screenshots/bundle-analysis.txt) - status 'Performance' 'error' "${description}" - exit 1 -fi - -set -e - -GIT_SHA_HEAD=$(git rev-parse HEAD) -GIT_SHA_MASTER=$(git rev-parse origin/master) -IS_RELEASE_TAG=$(git describe --exact-match --abbrev=0 --tags "${GIT_SHA_HEAD}" 2> /dev/null || :) -if [ "$GIT_SHA_HEAD" == "$GIT_SHA_MASTER" ]; then - echo "detected master build. building & pushing images..." - ./push.sh -elif [ ! -z "$IMAGE_TAG" ]; then - echo "detected request to push built image using tag ${IMAGE_TAG}. building & pushing images..." - ./push.sh -elif [ -n "$IS_RELEASE_TAG" ]; then - echo "detected release tag ${IS_RELEASE_TAG}. building & pushing images..." - ./push.sh -else - echo "skipping image push. HEAD sha does not appear to be master, nor is it a release tag: $GIT_SHA_HEAD" -fi - -echo "Cleaning up old Docker images..." - -set +e -# delete stopped containers -docker ps -a -q | xargs docker rm -# docker rm $(docker ps -a -q) - -# delete images except for console builder (fails on images currently used) -docker images | grep -F -v quay.io/coreos/tectonic-console-builder | awk '{print $3}' | grep -v IMAGE | xargs docker rmi - -# delete orphaned volumes -docker volume ls -qf dangling=true | xargs -r docker volume rm -set -e - -echo "Done!" diff --git a/test-gui-e2e-setup.sh b/test-gui-e2e-setup.sh deleted file mode 100755 index ff2db490113..00000000000 --- a/test-gui-e2e-setup.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -set -exuo pipefail - -ARTIFACT_DIR=/tmp/artifacts -export ARTIFACT_DIR - -./build.sh - -oc login -u kubeadmin -p $(cat "${ARTIFACT_DIR}/installer/auth/kubeadmin-password") - -source ./contrib/oc-environment.sh - -kubectl create -f https://raw.githubusercontent.com/operator-framework/operator-lifecycle-manager/master/deploy/okd/manifests/0.8.0/0000_30_06-rh-operators.configmap.yaml -kubectl create -f https://raw.githubusercontent.com/operator-framework/operator-lifecycle-manager/master/deploy/okd/manifests/0.8.0/0000_30_09-rh-operators.catalogsource.yaml