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

Commit

Permalink
Merge pull request #34 from jgawor/no_pipelines_dep
Browse files Browse the repository at this point in the history
Remove pipelines-utils dependency
  • Loading branch information
mcurran-us authored Nov 3, 2020
2 parents 6b8606c + c209cb5 commit 5cab069
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
12 changes: 9 additions & 3 deletions openshift/k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,20 @@ spec:
serviceAccountName: stack-hub-index
initContainers:
- name: init
image: INIT_IMAGE
image: NGINX_IMAGE
command: ['/bin/sh']
args:
- -cex
- |
APISERVER=https://kubernetes.default.svc
SERVICEACCOUNT=/var/run/secrets/kubernetes.io/serviceaccount
NAMESPACE=$(cat ${SERVICEACCOUNT}/namespace)
TOKEN=$(cat ${SERVICEACCOUNT}/token)
CACERT=${SERVICEACCOUNT}/ca.crt
for i in 1 2 3 4 5 6 7 8 9 10; do
ROUTE=$(kubectl get route stack-hub-index --no-headers -o=jsonpath='{.status.ingress[0].host}')
if [ -z "$ROUTE" ]; then
ROUTE=$(curl --cacert ${CACERT} --header "Authorization: Bearer ${TOKEN}" -X GET -s \
${APISERVER}/apis/route.openshift.io/v1/namespaces/$NAMESPACE/routes/stack-hub-index | jq -r .status.ingress[0].host)
if [ -z "$ROUTE" ] || [ "$ROUTE" = "null" ]; then
sleep 1
else
echo "http://$ROUTE" > /usr/share/stack-hub/route
Expand Down
10 changes: 10 additions & 0 deletions scripts/hub_clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash -e

script_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
base_dir=$(cd "${script_dir}/.." && pwd)

echo
echo "= Removing build and assets directories."
echo

rm -rf "${base_dir}/build" "${base_dir}/assets"
6 changes: 6 additions & 0 deletions scripts/hub_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ prereqs

# push nginx image
if [ -f "$build_dir/image_list" ]; then
echo
echo "= Pushing stack hub index image into your registry."
echo
while read line
do
if [ "$line" != "" ]; then
Expand All @@ -83,13 +85,17 @@ fi

# mirror stack images
if [ -f "$build_dir/image-mapping.txt" ]; then
echo
echo "= Mirroring stack and related images into your registry."
echo
image_mirror "$build_dir/image-mapping.txt"
fi

# deploy nginx container
if [ -f "$build_dir/openshift.yaml" ]; then
echo
echo "= Deploying stack hub index container into your cluster."
echo
oc apply -f "$build_dir/openshift.yaml"

INDEX_YAML=$(cd $build_dir/index-src && ls *-index.yaml | head -n 1)
Expand Down
2 changes: 1 addition & 1 deletion scripts/nginx-ubi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM registry.access.redhat.com/ubi8/ubi-minimal

COPY nginx-ubi/nginx.repo /etc/yum.repos.d/nginx.repo

RUN microdnf install nginx findutils \
RUN microdnf install nginx jq findutils \
&& mkdir /var/cache/nginx \
&& chown -R nginx:0 /var/log/nginx/ /var/cache/nginx /usr/share/nginx \
&& chmod -R g=u /var/log/nginx/ /var/cache/nginx /usr/share/nginx \
Expand Down
7 changes: 0 additions & 7 deletions scripts/post_build.d/appsody_stacks/build_nginx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,10 @@ image_build() {
}

openshift_deployment() {
SRC_INIT_IMAGE="docker.io/icp4apps/pipelines-utils:0.21.0-rc1"
INIT_IMAGE="$image_registry/$image_org/$(echo $SRC_INIT_IMAGE | cut -d'/' -f3)"

YAML_FILE=$build_dir/openshift.yaml
cp $base_dir/openshift/k8s.yaml $YAML_FILE
sed -i -e "s|NGINX_IMAGE|$image_registry/$image_org/${nginx_image_name}:${INDEX_VERSION}|" $YAML_FILE
sed -i -e "s|INIT_IMAGE|$INIT_IMAGE|" $YAML_FILE
sed -i -e "s|DATE|$(date -u '+%FT%TZ')|" $YAML_FILE

mapping_file=$build_dir/image-mapping.txt
grep -qxF "$SRC_INIT_IMAGE=$INIT_IMAGE" "$mapping_file" || echo "$SRC_INIT_IMAGE=$INIT_IMAGE" >> "$mapping_file"
}

if [ ! -z $BUILD ] && [ $BUILD == true ]
Expand Down

0 comments on commit 5cab069

Please sign in to comment.