Skip to content
Snippets Groups Projects
.gitlab-ci.yml 3.28 KiB
stages:
  - get_chart
  - deploy_rabbit
  - deploy_grb
  - deploy_g2g
  - deploy_wms
  - deploy_wmts

variables:
  DOCKER_TLS_CERTDIR: ""
  DOCKER_HOST: "tcp://localhost:2375"
  DOCKER_DRIVER: overlay2
  HELM_EXPERIMENTAL_OCI: "1"
  CICHART_IMAGE: "$CI_REGISTRY_IMAGE/cichart:latest"

build ci:
  stage: .pre
  image: docker:19.03.1
  tags:
    - docker
  services:
    - docker:19.03.1-dind
  before_script:
    - docker info
    - docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
    - alias helm='docker run -t --rm -e HELM_EXPERIMENTAL_OCI="$HELM_EXPERIMENTAL_OCI" -v $(pwd):/apps -w /apps -v ~/.kube:/root/.kube -v ~/.helm:/root/.helm -v ~/.config/helm:/root/.config/helm -v ~/.cache/helm:/root/.cache/helm alpine/helm:3.2.3'
    - helm registry login -u ${CI_REGISTRY_USER} -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
    - export
  script:
    - docker login --username $CI_REGISTRY_USER --password $CI_REGISTRY_PASSWORD $CI_REGISTRY
    - cd ci
    - docker build --tag $CICHART_IMAGE .
    - docker push $CICHART_IMAGE
  rules:
    - changes:
        - cichart/Dockerfile
      when: always
    - if: $BUILD_CI_IMAGE
      when: always


.get_chart_tmpl:
  stage: get_chart
  image: $CICHART_IMAGE
  services:
    - docker:19.03.1-dind
  tags:
    - docker
  variables:
    SUBCOMP_REPOS_BASE: "https://gitlab.ssec.wisc.edu/cspp_geo/geosphere"
    # required:
    SUBCOMP_REPOS: ""
    SUBCOMP_CHART_DIR: ""
  script:
    - repos_url="${SUBCOMP_REPOS_BASE}/${SUBCOMP_REPOS}"
    - git clone --depth 1 $repos_url
    - cd ${SUBCOMP_REPOS}
    # most recent docker image should be tagged with most recent SHA
    - docker_tag=$(git rev-parse --short HEAD)
    - echo $docker_tag
    # make the docker tag available in later stages
    - echo export docker_tag=$docker_tag >cibuild.env
    - cd chart
    - |-
      sed -i "s/^appVersion: .*\$/appVersion: ${docker_tag}/g" ${SUBCOMP_CHART_DIR}/Chart.yaml
    # debug:
    - helm template ${SUBCOMP_CHART_DIR} .
  artifacts:
    paths:
      - chart/${SUBCOMP_CHART_DIR}