Skip to content

Commit

Permalink
Add a build for OpenShift (#13)
Browse files Browse the repository at this point in the history
* Add build workflow

* Symlinking main.go

* Trying to pull in a tag of operator sdk

* Wrapping s2i script

* Assemble moved to bin

* Add GOBIN

* Exit if dep install fails

* Managing dependencies differently

* trying to install dep with go

* Stupid assemble script

* Restoring curl command:

* be explicit with gobin

* Absolute path to dep

* Debug

* Use upstream assemble

* Remove os import

* Debug

* Debug

* Rename output binary

* Convert build.yml to template, add deployment

* Lock go-config to v0.8.0

* Fix resync misconfiguration

* Change gobinary

* Lock go-config to 0.7.0

* Change default config from yml to yaml

* Improve error output when provider not found

* Adding the necessary pieces to run locally

* Add namespace param to rbac
  • Loading branch information
etsauer authored and sabre1041 committed Feb 21, 2019
1 parent 9553b0e commit a18fb2c
Show file tree
Hide file tree
Showing 18 changed files with 266 additions and 1,258 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@

# Temporary Build Files
tmp/_output
tmp/_test
build/_output
build/_test

# Build dependencies
vendor/
Gopkg.lock

# Created by https://www.gitignore.io/api/go,vim,emacs,visualstudiocode

Expand Down
74 changes: 74 additions & 0 deletions .s2i/bin/assemble
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/bin/bash

# Install dep
export GOBIN=/opt/app-root/src/go/bin
mkdir -p $GOBIN
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh

set -e

pushd /tmp/src

if [[ `go list -f {{.Incomplete}}` == "true" ]]; then

INSTALL_URL=${INSTALL_URL:-$IMPORT_URL}

if [[ ! -z "$IMPORT_URL" ]]; then

popd

echo "Assembling GOPATH"

export GOPATH=`realpath $HOME/go`

mkdir -p $GOPATH/src/$IMPORT_URL

mv /tmp/src/* $GOPATH/src/$IMPORT_URL

if [[ -d /tmp/artifacts/pkg ]]; then

echo "Restoring previous build artifacts"

mv /tmp/artifacts/pkg $GOPATH

fi

# Resolve dependencies, ignore if vendor present

if [[ ! -d $GOPATH/src/$INSTALL_URL/vendor ]]; then

echo "Resolving dependencies"

pushd $GOPATH/src/$INSTALL_URL

$GOBIN/dep ensure

popd

fi

# lets build

pushd $GOPATH/src/$INSTALL_URL

echo "Building"

go install -i $INSTALL_URL

mv $GOPATH/bin/$BINARY_NAME /opt/app-root/gobinary

popd

exit

fi

exec /$STI_SCRIPTS_PATH/usage

else

go build -o /opt/app-root/gobinary

popd

fi
Loading

0 comments on commit a18fb2c

Please sign in to comment.