Skip to content

Commit

Permalink
Adds Jenkinsfile and updates release-binary to create a SHA. (envoypr…
Browse files Browse the repository at this point in the history
…oxy#71)

* Adds Jenkinsfile and update release-binary
* Update Jenkinsfile and gitignore
* Fixes typo and use normal build Node
* Uses default bazel config
* Using batch mode
* Update bazel memory settings
* Do not use Jenkins bazel env
* Set .bazelrc for postsubmit
  • Loading branch information
sebastienvas authored Feb 9, 2017
1 parent d29a195 commit fdac61b
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 6 deletions.
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}"


0 comments on commit fdac61b

Please sign in to comment.