Skip to content

Commit

Permalink
fix(kong): do not release kong images (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
obdulia-losantos authored Sep 15, 2020
1 parent b52d835 commit 4cdd0e7
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 77 deletions.
47 changes: 9 additions & 38 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,14 @@
#
set -Eeuo pipefail

GW_VERSION=latest
source ./scripts/lib.sh || \
( echo -e "\033[91mRun this script from root folder\033[0m" && \
exit 1 )

function build_image {
APP=$1
VERSION=$2
if [ -z "${3-}" ]; then
LOCATION=$1
else
LOCATION=$3
fi
TRAVIS_COMMIT=${TRAVIS_COMMIT:-test}
TAG="${APP}:${VERSION}"
LINE="~~~~~~~~~~~~~~~"
build_image gateway-manager latest

echo -e ""
echo -e "\e[2m${LINE}\e[0m Building image: \e[1;92m${TAG}\e[0m \e[2m${LINE}\e[0m"
echo -e ""

docker build \
--pull \
--no-cache \
--force-rm \
--tag $TAG \
--build-arg VERSION=$VERSION \
--build-arg REVISION=$TRAVIS_COMMIT \
./$LOCATION

echo -e ""
echo -e "\e[2m${LINE}\e[0m Built image: \e[1;92m${TAG}\e[0m \e[2m${LINE}\e[0m"
echo -e ""
}

# GW Manager
build_image gateway-manager ${GW_VERSION}

# Custom Kong
KONG_RELEASES=( "1.3" "1.4" "1.5" "2.0" "2.1" "latest" )
for kong_version in "${KONG_RELEASES[@]}"; do
build_image kong $kong_version
done
# # Custom Kong
# KONG_RELEASES=( "1.3" "1.4" "1.5" "2.0" "2.1" "latest" )
# for kong_version in "${KONG_RELEASES[@]}"; do
# build_image kong $kong_version
# done
81 changes: 81 additions & 0 deletions scripts/lib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/usr/bin/env bash
#
# Copyright (C) 2020 by eHealth Africa : http://www.eHealthAfrica.org
#
# See the NOTICE file distributed with this work for additional information
# regarding copyright ownership.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
set -Eeuo pipefail

function build_image {
APP=$1
VERSION=$2
TRAVIS_COMMIT=${TRAVIS_COMMIT:-test}
TAG="${APP}:${VERSION}"
LINE="~~~~~~~~~~~~~~~"

echo -e ""
echo -e "\e[2m${LINE}\e[0m Building image: \e[1;92m${TAG}\e[0m \e[2m${LINE}\e[0m"
echo -e ""

docker build \
--pull \
--no-cache \
--force-rm \
--tag $TAG \
--build-arg VERSION=$VERSION \
--build-arg REVISION=$TRAVIS_COMMIT \
./$APP

echo -e ""
echo -e "\e[2m${LINE}\e[0m Built image: \e[1;92m${TAG}\e[0m \e[2m${LINE}\e[0m"
echo -e ""
}

function build_and_push {
APP=$1
VERSION=$2
IMAGE_REPO=ehealthafrica
TAG="${IMAGE_REPO}/${APP}:${VERSION}"
LINE="==============="

echo -e ""
echo -e "\e[2m${LINE}\e[0m Building image: \e[1;92m${TAG}\e[0m \e[2m${LINE}\e[0m"
echo -e ""

docker build \
--pull \
--no-cache \
--force-rm \
--tag $TAG \
--build-arg VERSION=$VERSION \
--build-arg REVISION=$TRAVIS_COMMIT \
./$APP

echo -e ""
echo -e "\e[2m${LINE}\e[0m Built image: \e[1;92m${TAG}\e[0m \e[2m${LINE}\e[0m"


echo -e ""
echo -e "\e[2m${LINE}\e[0m Pushing image: \e[1;92m${TAG}\e[0m \e[2m${LINE}\e[0m"
echo -e ""

docker push $TAG

echo -e ""
echo -e "\e[2m${LINE}\e[0m Pushed image: \e[1;92m${TAG}\e[0m \e[2m${LINE}\e[0m"
echo -e ""
}
47 changes: 8 additions & 39 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,49 +20,18 @@
#
set -Eeuo pipefail

function build_and_push {
APP=$1
VERSION=$2
IMAGE_REPO=ehealthafrica
TAG="${IMAGE_REPO}/${APP}:${VERSION}"
LINE="==============="

echo -e ""
echo -e "\e[2m${LINE}\e[0m Building image: \e[1;92m${TAG}\e[0m \e[2m${LINE}\e[0m"
echo -e ""

docker build \
--pull \
--no-cache \
--force-rm \
--tag $TAG \
--build-arg VERSION=$VERSION \
--build-arg REVISION=$TRAVIS_COMMIT \
./$APP

echo -e ""
echo -e "\e[2m${LINE}\e[0m Built image: \e[1;92m${TAG}\e[0m \e[2m${LINE}\e[0m"


echo -e ""
echo -e "\e[2m${LINE}\e[0m Pushing image: \e[1;92m${TAG}\e[0m \e[2m${LINE}\e[0m"
echo -e ""

docker push $TAG

echo -e ""
echo -e "\e[2m${LINE}\e[0m Pushed image: \e[1;92m${TAG}\e[0m \e[2m${LINE}\e[0m"
echo -e ""
}
source ./scripts/lib.sh || \
( echo -e "\033[91mRun this script from root folder\033[0m" && \
exit 1 )

# If there is no tag then create image for branch develop
GW_VERSION=${TRAVIS_TAG:-latest}

# GW Manager
build_and_push gateway-manager ${GW_VERSION}

# Custom Kong
KONG_RELEASES=( "1.3" "1.3.1" "1.4" "1.4.3" "1.5" "1.5.1" "2.0" "2.0.5" )
for kong_version in "${KONG_RELEASES[@]}"; do
build_and_push kong $kong_version
done
# # Custom Kong
# KONG_RELEASES=( "1.3" "1.3.1" "1.4" "1.4.3" "1.5" "1.5.1" "2.0" "2.0.5" )
# for kong_version in "${KONG_RELEASES[@]}"; do
# build_and_push kong $kong_version
# done

0 comments on commit 4cdd0e7

Please sign in to comment.