Skip to content
Snippets Groups Projects
Select Git revision
  • 982ff2114f2da19e2e30884b6b6a5656833749da
  • master default protected
  • L2SS-2331
  • L2SS-2347-dithering-dont-change-power-freq
  • aiv
  • aiv-fixes
  • fix-build-ubuntu
  • move-secrets
  • remove-ansible-2
  • add-remaining-dutch-stations
  • nomad-server-name-change
  • L2SS-1970-apsct-lol
  • L2SS-2347-dithering-is-global-setting
  • refactor-control-power-properties
  • update-lcu-rollout-procedure
  • test-pytango-10.0.3
  • revert-cs032-ccd-ip
  • deploy-components-parallel
  • L2SS-2357-fix-ruff
  • sync-up-with-meta-pypcc
  • stabilise-landing-page
  • v0.56.2-4 protected
  • v0.56.2-3 protected
  • v0.56.2-2 protected
  • v0.57.2-3 protected
  • v0.57.2-2 protected
  • v0.57.2-1 protected
  • v0.57.2 protected
  • v0.57.1-1 protected
  • v0.57.1 protected
  • v0.57.0 protected
  • v0.56.7 protected
  • v0.56.6 protected
  • v0.56.5-5 protected
  • v0.56.5-4 protected
  • v0.56.5-3 protected
  • v0.56.5-2 protected
  • v0.56.5.2 protected
  • v0.56.5-1 protected
  • v0.56.5.1 protected
  • v0.56.5 protected
41 results

pypcc-sim.yml

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    .gitlab-ci.yml 6.33 KiB
    stages:
      - test
      - build
      - integration
      - deploy_to_test
      - deploy_to_production
    
    workflow:
      rules:
        # don't create a pipeline if its a commit pipeline, on a branch and that branch has open merge requests.
        - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
          when: never
        - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
          variables:
            DOCKER_IMAGE_TAG: "latest"
        - if: $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
          variables:
            DOCKER_IMAGE_TAG: "$CI_COMMIT_REF_SLUG"
    
    test-code:
      image: python:3.10
      stage: test
      services:
        - postgres:11.0
      variables:
        POSTGRES_DB: ldv-spec-db
        POSTGRES_USER: postgres
        POSTGRES_PASSWORD: "atdb123"
      script:
        - cd ldvspec
        - pip install -r requirements/dev.txt
        - python manage.py migrate --settings ldvspec.settings.ci
        - python manage.py test --settings ldvspec.settings.ci
    
    docker-build:
      image: docker:20-cli
      stage: build
      services:
        - docker:dind
      before_script:
        - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
      script:
        - HASH=$(sha256sum ldvspec/Dockerfile.base | awk '{ print $1 }')
        - >
          if docker manifest inspect $CI_REGISTRY_IMAGE/base:$HASH > /dev/null; then
            echo "Base image exists"
          else
            docker build -t "$CI_REGISTRY_IMAGE/base:$HASH" -f ldvspec/Dockerfile.base ldvspec
            docker push "$CI_REGISTRY_IMAGE/base:$HASH"
          fi
        - echo "Build using $CI_REGISTRY_IMAGE/base:$HASH"
        # Try pulling the existing image for layer reuse; || true to ignore if it does not exist
        #- docker build --cache-from $CI_REGISTRY_IMAGE:$DOCKER_IMAGE_TAG --build-arg BASE_IMAGE="$CI_REGISTRY_IMAGE/base:$HASH" --pull -t "$CI_REGISTRY_IMAGE:$DOCKER_IMAGE_TAG" ldvspec
        - docker build --pull -t "$CI_REGISTRY_IMAGE:$DOCKER_IMAGE_TAG" ldvspec
        - docker push "$CI_REGISTRY_IMAGE:$DOCKER_IMAGE_TAG"
    
    integration-test:
      image: docker:20-cli
      services:
        - docker:20-dind
      before_script:
        - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
      stage: integration
      tags:
        - "sdc-dev"
      script:
        - cd integration
        # TODO: cache the integration image
        - docker compose build
        - docker compose up -d atdb-backend ldv-specification-backend