Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Jenkinsfile and updates release-binary to create a SHA. #71

Merged
merged 10 commits into from
Feb 9, 2017
Merged
8 changes: 8 additions & 0 deletions .bazelrc.jenkins
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This is from Bazel's former travis setup, to avoid blowing up the RAM usage.
startup --host_jvm_args=-Xmx8192m
startup --host_jvm_args=-Xms8192m
startup --batch

# This is so we understand failures better
build --verbose_failures

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/bazel-*
.idea/*
*.iml
61 changes: 61 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!groovy

@Library('testutils')

import org.istio.testutils.Utilities
import org.istio.testutils.GitUtilities
import org.istio.testutils.Bazel

// Utilities shared amongst modules
def gitUtils = new GitUtilities()
def utils = new Utilities()
def bazel = new Bazel()

node {
gitUtils.initialize()
// Proxy does build work correctly with Hazelcast.
// Must use .bazelrc.jenkins
bazel.setVars('', '')
}

mainFlow(utils) {
if (utils.runStage('PRESUBMIT')) {
def success = true
utils.updatePullRequest('run')
try {
presubmit(gitUtils, bazel)
} catch (Exception e) {
success = false
throw e
} finally {
utils.updatePullRequest('verify', success)
}
}
if (utils.runStage('POSTSUBMIT')) {
buildNode(gitUtils) {
bazel.updateBazelRc()
sh 'script/release-binary'
}
}
}

def presubmit(gitUtils, bazel) {
buildNode(gitUtils) {
stage('Code Check') {
sh('script/check-style')
}
bazel.updateBazelRc()
stage('Bazel Fetch') {
bazel.fetch('-k //...')
}
stage('Bazel Build') {
bazel.build('//...')
}
stage('Bazel Tests') {
bazel.test('//...')
}
stage('Push Test Binary') {
sh 'script/release-binary'
}
}
}
15 changes: 9 additions & 6 deletions script/release-binary
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,19 @@ set -ex
BUCKET_NAME="istio-build/proxy"

# The proxy binary name.
BINARY_FORMAT='envoy-alpha-%H.tar.gz'
BINARY_NAME="$(git show -q HEAD --pretty=format:"${BINARY_FORMAT}")"
SHA="$(git rev-parse --verify HEAD)"
BINARY_NAME="envoy-alpha-${SHA}.tar.gz"
SHA256_NAME="envoy-alpha-${SHA}.sha256"

# Build the binary
bazel build --config=release //src/envoy/mixer:envoy_tar
SRC="bazel-bin/src/envoy/mixer/envoy_tar.tar.gz"
DST="gs://${BUCKET_NAME}/${BINARY_NAME}"
BAZEL_TARGET="bazel-bin/src/envoy/mixer/envoy_tar.tar.gz"
ln "${BAZEL_TARGET}" "${BINARY_NAME}"
sha256sum "${BINARY_NAME}" > "${SHA256_NAME}"
DST="gs://${BUCKET_NAME}/"

# Copy it to the bucket.
echo "Copying ${SRC} to ${DST}"
gsutil cp ${SRC} ${DST}
echo "Copying ${BINARY_NAME} ${SHA256_NAME} to ${DST}"
gsutil cp "${BINARY_NAME}" "${SHA256_NAME}" "${DST}"