This GitLab CI configuration is valid. Learn more
.gitlab-ci.yml 1.56 KiB
stages:
  - test
  - build
test:
  image: python:3.9
  stage: test
  services:
      - name: gitlab.memri.io:5050/memri/pod:dev-latest
        alias: pod
        entrypoint:
          - "/pod"
          - "--owners=ANY"
          - "--insecure-non-tls=0.0.0.0"
  before_script:
      - pip install -e .[dev]
  script:
  - curl http://pod:3030/version
  - export POD_ADDRESS='http://pod:3030'
  - pre-commit run --all-files --show-diff-on-failure
  - pytest tests/
build_image:
  only:
    - dev
    - main
  stage: build
  before_script:
    - echo "Building docker image..."
  image: 
        # We recommend using the CERN version of the Kaniko image: gitlab-registry.cern.ch/ci-tools/docker-image-builder
        name: gcr.io/kaniko-project/executor:debug
        entrypoint: [""]
  script:
        # Prepare Kaniko configuration file
        - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
        # Build and push the image from the Dockerfile at the root of the project.
        # To push to a specific docker tag, amend the --destination parameter, e.g. --destination $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
        # See https://docs.gitlab.com/ee/ci/variables/predefined_variables.html#variables-reference for available variables
        - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --build-arg CI_JOB_TOKEN=$CI_JOB_TOKEN --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-latest