Migrates build to kaniko

* Changes the executor
* Adds `ix_id` label to the GELF log shipping, for easy aggregation
parent 9e47aba9
Pipeline #72029709 passed with stages
in 1 minute and 12 seconds
variables:
DOCKER_DRIVER: overlay2
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
PORT: 9308
stages:
- lint
- build
services:
- docker:dind
.tags-template: &tags-definition
tags:
- ix-ai
.build-template: &build-definition
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
stage: build
script:
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"username\":\"${CI_REGISTRY_USER}\",\"password\":\"${CI_REGISTRY_PASSWORD}\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context ${CI_PROJECT_DIR} --dockerfile ${CI_PROJECT_DIR}/Dockerfile --build-arg PORT=${PORT} --destination ${IMAGE_TAG}
pylint:
image: python:latest
stage: lint
script:
- curl -o .pylintrc https://tool.ix.ai/.pylintrc
- pip install prometheus_client pylint requests pygelf
- pip install prometheus_client pylint coinbase pygelf
- pylint --rcfile=.pylintrc src/*.py
<<: *tags-definition
build:
image: docker:latest
stage: build
build:test:
except:
- master
before_script:
- export IMAGE_TAG="${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}"
<<: *tags-definition
<<: *build-definition
build:release:
only:
- /^latest$/
- tags
- /(.*)-dev$/
script:
- docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
- docker build -f Dockerfile -t ${IMAGE_TAG} --build-arg PORT="${PORT}" .
- docker push ${IMAGE_TAG}
- master
- latest
before_script:
- export IMAGE_TAG="${CI_REGISTRY_IMAGE}:latest"
<<: *tags-definition
<<: *build-definition
......@@ -28,7 +28,8 @@ def configure_logging():
host=os.environ.get('GELF_HOST'),
port=int(os.environ.get('GELF_PORT', 12201)),
debug=True,
include_extra_fields=True
include_extra_fields=True,
_ix_id=os.path.splitext(sys.modules['__main__'].__file__)[0],
)
LOG.addHandler(GELF)
gelf_enabled = True
......
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