Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Commit

Permalink
Install an Appsody Operator in preparation for deployment (#18)
Browse files Browse the repository at this point in the history
* Initial code drop

* Added readme and .travis.yml

* Made docker org an env var.

* added a deploy phase

* Adjusted deploy phase

* Added Appsody operator install

* Continues if operator already exists

* Removed LATEST from var name
  • Loading branch information
chilanti authored and neeraj-laad committed Oct 23, 2019
1 parent 17bc5db commit b851b47
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ RUN apt-get update && \
apt-get -y install sudo jq wget

ARG CLI_VERSION
ENV KUBE_VERSION="v1.11.1"
RUN wget https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/bin/linux/amd64/kubectl
RUN mv ./kubectl /usr/local/bin
RUN chmod 755 /usr/local/bin/kubectl
RUN wget https://github.com/appsody/appsody/releases/download/$CLI_VERSION/appsody_${CLI_VERSION}_amd64.deb
RUN apt install -f ./appsody_${CLI_VERSION}_amd64.deb

COPY setupAndRunExtract.sh .
RUN chmod +x setupAndRunExtract.sh
RUN chmod +x setupAndRunExtract.sh
22 changes: 20 additions & 2 deletions setupAndRunExtract.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
#!/bin/bash
set -e
# inspecting the container to find the mounts
containerid=`docker ps|grep appsody-docker|awk '{print $1}'`
docker ps
containerid=`docker ps|grep k8s_step-build-push-step|awk '{print $1}'`
echo Container ID: ${containerid}
dockerinspect=`docker inspect ${containerid}`
# checking the mounts to extract the workspace mount
notdone=true
found=false
idx=0
while [ "$notdone" = true ]; do
echo $idx
dest=`echo ${dockerinspect}|jq --argjson index $idx '.[] | .Mounts[$index].Destination '`
echo $dest
echo Destination: $dest
if [ "$dest" = "\"/workspace\"" ] ; then
source=`echo ${dockerinspect}|jq --argjson index $idx '.[] | .Mounts[$index].Source '`
found=true
Expand Down Expand Up @@ -43,3 +46,18 @@ appsody extract -v
# Copy the extracted contents to /workspace/extracted
cp -rf /builder/home/.appsody/extract/$postfix/* /builder/home/.appsody/extract/$postfix/.[!.]* /workspace/extracted/
ls -latr /workspace/extracted
echo "Running appsody operator install..."
set +e
errormessage=$( appsody operator install 2>&1 > /dev/null)

if [ ! "$?" == 0 ]; then
echo Error message: $errormessage
if [[ "$errormessage" == *"An operator already exists"* ]]; then
echo "Operator already exists - continue processing..."
else
echo "Failed to install the Appsody operator"
exit 1
fi
fi

echo "Done!"

0 comments on commit b851b47

Please sign in to comment.