Skip to content

Commit

Permalink
Merge pull request #207 from gmacario/feat-configure-gogeniviorg
Browse files Browse the repository at this point in the history
Add support for implementing a gocd agent
  • Loading branch information
gmacario committed Jan 26, 2016
2 parents 97090fe + b687a67 commit 978121f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions build-yocto-genivi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ RUN id build >/dev/null || useradd --create-home --shell /bin/bash build

RUN mkdir -p /usr/local/bin
COPY clone-and-build-gdp.sh /usr/local/bin/
COPY run-gocd-agent.sh /usr/local/bin/
RUN dos2unix /usr/local/bin/*.sh && chmod 755 /usr/local/bin/*.sh

# Expose sshd port
Expand Down
41 changes: 41 additions & 0 deletions build-yocto-genivi/run-gocd-agent.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

# ===========================================================================
# Project: gmacario/easy-build
#
# Run as a GoCD Agent
#
# Example of usage
#
# $ docker run -d --user=go \
# --hostname my-genivigo-testagent \
# --workdir /var/lib/go-agent \
# gmacario/build-yocto-genivi /usr/local/bin/run-gocd-agent.sh
# ===========================================================================

# set -x
set -e

# Sanity checks

if [ $(whoami) != 'go' ]; then
echo "Please specify docker run --user go"
exit 1
fi
if [ $(pwd) != '/var/lib/go-agent' ]; then
echo "Please specify docker run --workdir /var/lib/go-agent"
exit 1
fi
if [ "${GO_SERVER}" == "" ]; then
export GO_SERVER=go.genivi.org
echo "GO_SERVER was not defined - setting to ${GO_SERVER}"
fi

git config --global user.name "easy-build"
git config --global user.email "$(whoami)@$(hostname)"

cp /etc/default/go-agent go-agent.ORIG
sed "s/^GO_SERVER=.*$/GO_SERVER=${GO_SERVER}/g" go-agent.ORIG >/etc/default/go-agent
service go-agent start

# EOF

0 comments on commit 978121f

Please sign in to comment.