Skip to content

Commit

Permalink
Add set -x in a few specific areas
Browse files Browse the repository at this point in the history
  • Loading branch information
bsquizz committed Oct 18, 2021
1 parent 60b0d22 commit 2a0ac7f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cicd/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,31 +38,43 @@ function build {
function docker_build {
DOCKER_CONF="$PWD/.docker"
mkdir -p "$DOCKER_CONF"
set -x
docker --config="$DOCKER_CONF" login -u="$QUAY_USER" -p="$QUAY_TOKEN" quay.io
docker --config="$DOCKER_CONF" login -u="$RH_REGISTRY_USER" -p="$RH_REGISTRY_TOKEN" registry.redhat.io
set +x
if [ "$CACHE_FROM_LATEST_IMAGE" == "true" ]; then
echo "Attempting to build image using cache"
{
set -x
docker --config="$DOCKER_CONF" pull "${IMAGE}" &&
docker --config="$DOCKER_CONF" build -t "${IMAGE}:${IMAGE_TAG}" $APP_ROOT -f $APP_ROOT/$DOCKERFILE --cache-from "${IMAGE}"
set +x
} || {
echo "Build from cache failed, attempting build without cache"
set -x
docker --config="$DOCKER_CONF" build -t "${IMAGE}:${IMAGE_TAG}" $APP_ROOT -f $APP_ROOT/$DOCKERFILE
set +x
}
else
set -x
docker --config="$DOCKER_CONF" build -t "${IMAGE}:${IMAGE_TAG}" $APP_ROOT -f $APP_ROOT/$DOCKERFILE
set +x
fi
set -x
docker --config="$DOCKER_CONF" push "${IMAGE}:${IMAGE_TAG}"
set +x
}

function podman_build {
AUTH_CONF_DIR="$(pwd)/.podman"
mkdir -p $AUTH_CONF_DIR
export REGISTRY_AUTH_FILE="$AUTH_CONF_DIR/auth.json"
set -x
podman login -u="$QUAY_USER" -p="$QUAY_TOKEN" quay.io
podman login -u="$RH_REGISTRY_USER" -p="$RH_REGISTRY_TOKEN" registry.redhat.io
podman build -f $APP_ROOT/$DOCKERFILE -t "${IMAGE}:${IMAGE_TAG}" $APP_ROOT
podman push "${IMAGE}:${IMAGE_TAG}"
set +x
}


Expand Down
5 changes: 5 additions & 0 deletions cicd/cji_smoke_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ if [[ -z $IQE_CJI_TIMEOUT ]]; then
fi

# Invoke the CJI using the options set via env vars
set -x
pod=$(
bonfire deploy-iqe-cji $COMPONENT_NAME \
--marker "$IQE_MARKER_EXPRESSION" \
Expand All @@ -39,13 +40,16 @@ pod=$(
--env "clowder_smoke" \
--cji-name $CJI_NAME \
--namespace $NAMESPACE)
set +x

# Pipe logs to background to keep them rolling in jenkins
oc logs -n $NAMESPACE $pod -f &

# Wait for the job to Complete or Fail before we try to grab artifacts
# condition=complete does trigger when the job fails
set -x
oc wait --timeout=$IQE_CJI_TIMEOUT --for=condition=JobInvocationComplete -n $NAMESPACE cji/$CJI_NAME
set +x

# Get the minio client
# TODO: bake this into jenkins agent template
Expand All @@ -68,6 +72,7 @@ export MINIO_HOST=localhost
export MINIO_PORT=$LOCAL_SVC_PORT

# Setup the minio client to auth to the local eph minio in the ns
echo "Fetching artifacts from minio..."
./mc alias set minio http://$MINIO_HOST:$MINIO_PORT $MINIO_ACCESS $MINIO_SECRET_KEY

# "mirror" copies the entire artifacts dir from the pod and writes it to the jenkins node
Expand Down
2 changes: 2 additions & 0 deletions cicd/deploy_ephemeral_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ DB_DEPLOYMENT_NAME="${DB_DEPLOYMENT_NAME:-$COMPONENT_NAME-db}"
NAMESPACE=$(bonfire namespace reserve)
# TODO: add code to bonfire to deploy an app if it is defined in 'sharedAppDbName' on the ClowdApp
# TODO: add a bonfire command to deploy just an app's DB
set -x
bonfire process \
$APP_NAME \
--source=appsre \
Expand All @@ -23,6 +24,7 @@ bonfire process \
$COMPONENTS_RESOURCES_ARG | oc apply -f - -n $NAMESPACE

bonfire namespace wait-on-resources $NAMESPACE --db-only
set +x

# Set up port-forward for DB
LOCAL_DB_PORT=$(python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()')
Expand Down
2 changes: 2 additions & 0 deletions cicd/deploy_ephemeral_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ source ${CICD_ROOT}/_common_deploy_logic.sh
# Deploy k8s resources for app and its dependencies (use insights-stage instead of insights-production for now)
# -> use this PR as the template ref when downloading configurations for this component
# -> use this PR's newly built image in the deployed configurations
set -x
export NAMESPACE=$(bonfire namespace reserve)
bonfire deploy \
${APP_NAME} \
Expand All @@ -14,3 +15,4 @@ bonfire deploy \
--timeout ${DEPLOY_TIMEOUT} \
${COMPONENTS_ARG} \
${COMPONENTS_RESOURCES_ARG}
set +x

0 comments on commit 2a0ac7f

Please sign in to comment.