Skip to content

Commit

Permalink
feat(ci): build debug image when branch not master
Browse files Browse the repository at this point in the history
  • Loading branch information
ChandonPierre committed Sep 8, 2023
1 parent 60346d7 commit 46b89d0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,34 @@ default:
tags:
- ord1-tenant

workflow:
rules:
- if: $CI_SOURCE_BRANCH != "coreweave"
variables: &variables
DEBUG: "1"

stages:
- build
- release

build:
stage: build
variables:
<<: *variables
REF_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
FIXED_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
DOCKERFILE: ${CI_PROJECT_DIR}/Dockerfile
before_script:
- export HTTP_PROXY=${CACHE_PROXY}
- export DEBUG=${DEBUG}
- export NO_PROXY=${CACHE_REGISTRY_HOST}
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
script: |-
/kaniko/executor \
$KANIKO_ADDTL_ARGS \
--context . \
--build-arg DEBUG=$DEBUG \
--dockerfile $DOCKERFILE \
--destination $REF_IMAGE \
--destination $FIXED_IMAGE
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ LABEL org.opencontainers.image.source https://github.com/rpardini/docker-registr
RUN apk add --no-cache --update bash ca-certificates-bundle coreutils openssl

# If set to 1, enables building mitmproxy, which helps a lot in debugging, but is super heavy to build.
ARG DEBUG_BUILD="0"
ARG DEBUG_BUILD=${DEBUG:-"0"}
ENV DO_DEBUG_BUILD="$DEBUG_BUILD"

# Build mitmproxy via pip. This is heavy, takes minutes do build and creates a 90mb+ layer. Oh well.
Expand Down

0 comments on commit 46b89d0

Please sign in to comment.