Commit 9b2befb6 authored by James Fargher's avatar James Fargher

Use auto-build-image for build stage

parent c44c83c4
Pipeline #48987002 passed with stages
in 136 minutes and 56 seconds
---
title: Use auto-build-image for build job in Auto-DevOps.gitlab-ci.yml
merge_request: 24279
author:
type: changed
......@@ -73,12 +73,11 @@ stages:
build:
stage: build
image: docker:stable-git
image: "registry.gitlab.com/gitlab-org/cluster-integration/auto-build-image/master:stable"
services:
- docker:stable-dind
- docker:stable-dind
script:
- setup_docker
- build
- /build/build.sh
only:
- branches
......@@ -490,7 +489,6 @@ rollout 100%:
export DATABASE_URL=${DATABASE_URL-$auto_database_url}
export CI_APPLICATION_REPOSITORY=$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG
export CI_APPLICATION_TAG=$CI_COMMIT_SHA
export CI_CONTAINER_NAME=ci_job_build_${CI_JOB_ID}
export TILLER_NAMESPACE=$KUBE_NAMESPACE
# Extract "MAJOR.MINOR" from CI_SERVER_VERSION and generate "MAJOR-MINOR-stable" for Security Products
export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
......@@ -849,50 +847,6 @@ rollout 100%:
fi
}
function build() {
registry_login
if [[ -f Dockerfile ]]; then
echo "Building Dockerfile-based application..."
docker build \
--build-arg HTTP_PROXY="$HTTP_PROXY" \
--build-arg http_proxy="$http_proxy" \
--build-arg HTTPS_PROXY="$HTTPS_PROXY" \
--build-arg https_proxy="$https_proxy" \
--build-arg FTP_PROXY="$FTP_PROXY" \
--build-arg ftp_proxy="$ftp_proxy" \
--build-arg NO_PROXY="$NO_PROXY" \
--build-arg no_proxy="$no_proxy" \
-t "$CI_APPLICATION_REPOSITORY:$CI_APPLICATION_TAG" .
else
echo "Building Heroku-based application using gliderlabs/herokuish docker image..."
docker run -i \
-e BUILDPACK_URL \
-e HTTP_PROXY \
-e http_proxy \
-e HTTPS_PROXY \
-e https_proxy \
-e FTP_PROXY \
-e ftp_proxy \
-e NO_PROXY \
-e no_proxy \
--name="$CI_CONTAINER_NAME" -v "$(pwd):/tmp/app:ro" gliderlabs/herokuish /bin/herokuish buildpack build
docker commit "$CI_CONTAINER_NAME" "$CI_APPLICATION_REPOSITORY:$CI_APPLICATION_TAG"
docker rm "$CI_CONTAINER_NAME" >/dev/null
echo ""
echo "Configuring $CI_APPLICATION_REPOSITORY:$CI_APPLICATION_TAG docker image..."
docker create --expose 5000 --env PORT=5000 --name="$CI_CONTAINER_NAME" "$CI_APPLICATION_REPOSITORY:$CI_APPLICATION_TAG" /bin/herokuish procfile start web
docker commit "$CI_CONTAINER_NAME" "$CI_APPLICATION_REPOSITORY:$CI_APPLICATION_TAG"
docker rm "$CI_CONTAINER_NAME" >/dev/null
echo ""
fi
echo "Pushing to GitLab Container Registry..."
docker push "$CI_APPLICATION_REPOSITORY:$CI_APPLICATION_TAG"
echo ""
}
function initialize_tiller() {
echo "Checking Tiller..."
......
  • Updated my .gitlab-ci.yml based on the latest from yesterday which included this (along with a couple more updates)

    With a node detected app, 95% of the time the liveness/health checks will just fail with no logs whatsoever like my start script was never getting called. Created a basic hello-world application which worked and slowly increased it in complexity to try and see what was causing my problems deploying.

    Eventually I ran into the deployment issue and none of my apps were deploying to staging correctly. After using kubectl on the CrashLoopBackOff pods you'll get no logs and describe will pretty much say:

    Warning  Unhealthy  15m (x134 over 2h)  kubelet, gke-my-cluster-default-pool-8b037576-jqp8  Liveness probe failed: Get http://10.52.0.79:5000/: dial tcp 10.52.0.79:5000: connect: connection refused
    Warning  BackOff    21s (x530 over 2h)  kubelet, gke-my-cluster-default-pool-8b037576-jqp8  Back-off restarting failed containe

    Increasing both initialDelaySeconds of health/liveness caused me to think it was fixed but it only improved things but it was still flakey as hell.

    Not sure where else to mention this but it's caused me no end of grief these past 2 days :) Reverted the above changes and my apps consistently deploy now.

  • @intellix1 it would be good if you could raise an issue for this so we can keep track.

    The container images built with this extracted auto-build-image job should be identical to before. So I would be curious to see what the differences are in the resulting images.

    Otherwise, do you have the full diff in the config? Just in case there are other changes that may affect this.

Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment