Permalink
Browse files

build fly cli binaries natively

- add job to build fly cli natively
- pass along built binaries to bosh-rc and bin-rc

[#129925039]

Signed-off-by: Chris Dutra <cdutra@pivotal.io>
  • Loading branch information...
1 parent b074c8b commit fb52b42dd4ce755e30d73af3f58720678a6ee008 @joshzarrabi joshzarrabi committed with cdutra Sep 15, 2016
View
@@ -49,3 +49,6 @@ tags
.bosh
.gitconfig
+
+#fly binaries
+src/fly_binaries/*
@@ -8,6 +8,7 @@ image_resource:
inputs:
- name: concourse
+- name: fly-binaries
- name: version
- name: final-version
@@ -0,0 +1,15 @@
+---
+platform: darwin
+
+inputs:
+ - name: concourse
+ - name: final-version
+
+params:
+ platform: darwin
+
+outputs:
+ - name: darwin
+
+run:
+ path: concourse/ci/scripts/fly-build
@@ -0,0 +1,20 @@
+---
+platform: linux
+
+image_resource:
+ type: docker-image
+ source:
+ repository: concourse/atc-ci
+
+inputs:
+ - name: concourse
+ - name: final-version
+
+outputs:
+ - name: linux
+
+params:
+ platform: linux
+
+run:
+ path: concourse/ci/scripts/fly-build
@@ -0,0 +1,15 @@
+---
+platform: windows
+
+inputs:
+ - name: concourse
+ - name: final-version
+
+outputs:
+ - name: windows
+
+params:
+ platform: windows
+
+run:
+ path: concourse/ci/scripts/fly-build.bat
@@ -8,6 +8,7 @@ groups:
- baggageclaim
- tsa
- rc
+ - build-fly
- bin-rc
- bosh-rc
- bin-testflight
@@ -143,23 +144,57 @@ jobs:
- put: version
params: {file: version/version}
-- name: bosh-rc
+- name: build-fly
public: true
plan:
- get: concourse
+ trigger: true
+ passed: [rc]
+ - get: version
+ trigger: true
passed: [rc]
+ - get: final-version
+ resource: version
+ passed: [rc]
+ params: {bump: final}
trigger: true
- get: garden-runc
+ trigger: true
passed: [rc]
+ - aggregate:
+ - task: build-linux
+ file: concourse/ci/fly-build-linux.yml
+ - task: build-darwin
+ file: concourse/ci/fly-build-darwin.yml
+ - task: build-windows
+ file: concourse/ci/fly-build-windows.yml
+ timeout: 15m
+ attempts: 2
+ - task: tarball-flies
+ file: concourse/ci/tarball-flies.yml
+ - put: fly-binaries
+ params: { file: fly-binaries/fly-*.tgz }
+
+- name: bosh-rc
+ public: true
+ plan:
+ - get: concourse
+ passed: [build-fly]
+ trigger: true
+ - get: garden-runc
+ passed: [build-fly]
trigger: true
- get: version
- passed: [rc]
+ passed: [build-fly]
trigger: true
- get: final-version
resource: version
- passed: [rc]
+ passed: [build-fly]
params: {bump: final}
trigger: true
+ - get: fly-binaries
+ trigger: true
+ passed: [build-fly]
- task: create-bosh-rc
file: concourse/ci/create-bosh-rc.yml
- put: bosh-rc
@@ -171,28 +206,31 @@ jobs:
plan:
- aggregate:
- get: concourse
- passed: [rc]
+ passed: [build-fly]
trigger: true
- get: version
- passed: [rc]
+ passed: [build-fly]
trigger: true
- get: final-version
resource: version
- passed: [rc]
+ passed: [build-fly]
params: {bump: final}
trigger: true
- get: garden-runc
- passed: [rc]
+ passed: [build-fly]
trigger: true
- get: bin
trigger: true
- get: houdini
trigger: true
- get: garden-runc-src
+ - get: fly-binaries
+ trigger: true
+ passed: [build-fly]
- task: checkout-release-tag
file: concourse/ci/checkout-garden-runc.yml
- - task: build-cli-artifacts
- file: bin/ci/build-cli-artifacts.yml
+ - task: untar-cli-artifacts
+ file: bin/ci/untar-cli-artifacts.yml
- aggregate:
- task: build-linux
file: bin/ci/build-linux.yml
@@ -778,6 +816,15 @@ resources:
source:
repository: cloudfoundry-incubator/garden-runc-release
+- name: fly-binaries
+ type: s3
+ source:
+ bucket: concourse-fly
+ regexp: fly-(.*).tgz
+ access_key_id: {{pipeline-bucket-access-key}}
+ secret_access_key: {{pipeline-bucket-secret-key}}
+ region_name: us-west-1
+
- name: tracker
type: tracker
source:
@@ -6,6 +6,9 @@ set -e
OUTPUT="$PWD/bosh-rc"
VERSION="$(cat version/version)"
FINAL_VERSION="$(cat final-version/version)"
+FLY_BINARIES=fly-binaries/fly-$VERSION.tgz
+
+mv $FLY_BINARIES concourse/src/fly_binaries/
pushd concourse/
echo "$FINAL_VERSION" > src/version/VERSION
View
@@ -0,0 +1,18 @@
+#!/bin/bash
+# vim: set ft=sh
+
+set -e -x
+
+export GOPATH=$PWD/concourse
+export PATH=$GOPATH/bin:/usr/local/bin:$PATH
+export HOME=$PWD
+
+FINAL_VERSION="$(cat final-version/version)"
+
+cd ${GOPATH}/src/github.com/concourse/fly
+
+GOARCH=amd64 CGO_ENABLED=0 \
+ go build \
+ -ldflags "-X github.com/concourse/fly/version.Version=${FINAL_VERSION}" \
+ -o ${HOME}/${platform}/amd64/fly \
+ github.com/concourse/fly
@@ -0,0 +1,8 @@
+set PATH=C:\Go\bin;%PATH
+
+set GOPATH=%CD%\concourse
+set PATH=%CD%\concourse\bin;%PATH%
+
+set /p FinalVersion=<final-version\version
+
+go build -ldflags "-X github.com/concourse/fly/version.Version=%FinalVersion%" -o windows/amd64/fly github.com/concourse/fly
@@ -0,0 +1,8 @@
+#!/bin/bash
+# vim: set ft=sh
+
+set -e -x
+
+VERSION="$(cat version/version)"
+
+tar -czf fly-binaries/fly-${VERSION}.tgz ./darwin ./linux ./windows
View
@@ -0,0 +1,23 @@
+---
+platform: linux
+
+image_resource:
+ type: docker-image
+ source:
+ repository: concourse/atc-ci
+
+inputs:
+ - name: concourse
+ - name: version
+ - name: linux
+ - name: darwin
+ - name: windows
+
+outputs:
+ - name: fly-binaries
+
+params:
+ platform: linux
+
+run:
+ path: concourse/ci/scripts/tarball-flies
@@ -1,26 +1,41 @@
set -e
-REPO_NAME=github.com/concourse/fly
+VERSION_FILE=/var/vcap/packages/concourse_version/version
-export GOROOT=$(readlink -nf /var/vcap/packages/golang)
-export GOPATH=$BOSH_INSTALL_TARGET
-export PATH=$GOROOT/bin:$PATH
+FLY_BINARIES_FILENAME=fly_binaries/fly-$(cat $VERSION_FILE).tgz
-mkdir ${BOSH_INSTALL_TARGET}/src
-cp -a * ${BOSH_INSTALL_TARGET}/src
+if [ -e "$FLY_BINARIES_FILENAME" ]; then
+ echo "Using existing fly binaries"
+
+ mkdir -p ${BOSH_INSTALL_TARGET}
+
+ tar -xzf $FLY_BINARIES_FILENAME
+ mv fly-$(cat $VERSION_FILE)/* ${BOSH_INSTALL_TARGET}/
+
+else
+ echo "Building fly binaries"
+
+ REPO_NAME=github.com/concourse/fly
+
+ export GOROOT=$(readlink -nf /var/vcap/packages/golang)
+ export GOPATH=$BOSH_INSTALL_TARGET
+ export PATH=$GOROOT/bin:$PATH
+
+ mkdir ${BOSH_INSTALL_TARGET}/src
+ cp -a * ${BOSH_INSTALL_TARGET}/src
-VERSION_FILE=/var/vcap/packages/concourse_version/version
-for platform in linux darwin windows; do
- mkdir -p ${BOSH_INSTALL_TARGET}/${platform}/amd64
+ for platform in linux darwin windows; do
+ mkdir -p ${BOSH_INSTALL_TARGET}/${platform}/amd64
- GOOS=${platform} GOARCH=amd64 \
- CGO_ENABLED=0 \
- go build \
- -ldflags "-X github.com/concourse/fly/version.Version=$(cat $VERSION_FILE)" \
- -o ${BOSH_INSTALL_TARGET}/${platform}/amd64/fly \
- ${REPO_NAME}
-done
+ GOOS=${platform} GOARCH=amd64 \
+ CGO_ENABLED=0 \
+ go build \
+ -ldflags "-X github.com/concourse/fly/version.Version=$(cat $VERSION_FILE)" \
+ -o ${BOSH_INSTALL_TARGET}/${platform}/amd64/fly \
+ ${REPO_NAME}
+ done
+fi
rm -rf ${BOSH_INSTALL_TARGET}/pkg
rm -rf ${BOSH_INSTALL_TARGET}/src
View
@@ -6,6 +6,7 @@ dependencies:
- golang
files:
+ - fly_binaries/*
- github.com/aryann/difflib/*.go # gosub
- github.com/bmizerany/pat/*.go # gosub
- github.com/concourse/atc/*.go # gosub
No changes.

0 comments on commit fb52b42

Please sign in to comment.