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
3 changes: 3 additions & 0 deletions .bazelrc.jenkins
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 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
58 changes: 58 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!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()
//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) {
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('--strategy=CppCompile=standalone //...')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure this is working, the BUILD file for envoy requires bazel sandbox at the time I wrote them.

}
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}"