Skip to content

Instantly share code, notes, and snippets.

@Algogator
Created March 17, 2020 19:47
Show Gist options
  • Save Algogator/73cbdcd8391b801377e9d83f2980143b to your computer and use it in GitHub Desktop.
Save Algogator/73cbdcd8391b801377e9d83f2980143b to your computer and use it in GitHub Desktop.
CI
image: docker:stable
stages:
- build
- test
variables:
IMAGE: ${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}
build:
stage: build
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
script:
- docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
- docker pull $IMAGE:latest || true
- docker build
--cache-from $IMAGE:latest
--tag $IMAGE:latest
--file ./Dockerfile.prod
"."
- docker push $IMAGE:latest
test:
stage: test
image: $IMAGE:latest
services:
- postgres:latest
variables:
POSTGRES_DB: users
POSTGRES_USER: runner
POSTGRES_PASSWORD: ""
DATABASE_TEST_URL: postgres://runner@postgres:5432/users
script:
- pytest "project/tests" -p no:warnings
- flake8 project
- black project --check
- isort project/**/*.py --check-only
Running with gitlab-runner 12.8.0 (1b659122)
on aphilips ZaU-UuFE
Using Docker executor with image registry.gitlab.com/gitlab-org/cluster-integration/auto-build-image/master:stable ...
00:30
Starting service docker:19.03.5-dind ...
Pulling docker image docker:19.03.5-dind ...
Using docker image sha256:8489eeb24a264b6bcdb17f3da00140cebe92ee36bd22365f37d07d59390df4ee for docker:19.03.5-dind ...
Waiting for services to be up and running...
*** WARNING: Service runner-ZaU-UuFE-project-46-concurrent-0-docker-0 probably didn't start properly.
Health check error:
ContainerStart: Error response from daemon: Cannot link to a non running container: /runner-ZaU-UuFE-project-46-concurrent-0-docker-0 AS /runner-ZaU-UuFE-project-46-concurrent-0-docker-0-wait-for-service/service (executor_docker.go:1230:1s)
Service container logs:
2020-03-17T19:35:22.634435555Z mount: permission denied (are you root?)
2020-03-17T19:35:22.634490732Z Could not mount /sys/kernel/security.
2020-03-17T19:35:22.634501619Z AppArmor detection and --privileged mode might break.
2020-03-17T19:35:22.637772472Z mount: permission denied (are you root?)
*********
Pulling docker image registry.gitlab.com/gitlab-org/cluster-integration/auto-build-image/master:stable ...
Using docker image sha256:c34686777225a2963abd71cd554fe1d68739cd9f34e281e9f49b2747053877b7 for registry.gitlab.com/gitlab-org/cluster-integration/auto-build-image/master:stable ...
Running on runner-ZaU-UuFE-project-46-concurrent-0 via aphilips...
00:05
Fetching changes with git depth set to 50...
00:05
Initialized empty Git repository in /builds/gitlab/aphilips/test_api/.git/
Created fresh repository.
From http://modernmonks/gitlab/aphilips/test_api
* [new ref] refs/pipelines/105 -> refs/pipelines/105
* [new branch] master -> origin/master
Checking out 60fe146b as master...
Skipping Git submodules setup
$ if [[ -z "$CI_COMMIT_TAG" ]]; then # collapsed multi-line command
00:04
$ /build/build.sh
Building Dockerfile-based application...
invalid reference format
invalid reference format
invalid argument "/master:60fe146bd8a307d7511daa89c7cd3b53a28a55ed" for "-t, --tag" flag: invalid reference format
See 'docker build --help'.
ERROR: Job failed: exit code 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment