Commit 9c8a7388 authored by Price, Zach's avatar Price, Zach
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading
Loading

.dockerignore

0 → 100644
+4 −0
Original line number Diff line number Diff line
*.py[oc]
Dockefile
helm
.git

.gitignore

0 → 100644
+3 −0
Original line number Diff line number Diff line
__pycache__
*.py[co]
*.egg-info

.gitlab-ci.yml

0 → 100644
+120 −0
Original line number Diff line number Diff line
stages:
- test-chart
- build
- deploy

variables:
  IMAGE_REPO: camden.ornl.gov/arm/adl
  PROJECT_NAME: adl
  FF_GITLAB_REGISTRY_HELPER_IMAGE: 'true'

chart_lint:
  stage: test-chart
  image: camden.ornl.gov/hub_proxy/alpine/helm:latest
  tags:
    - arm-k8s
  script:
    - helm lint helm/adl

build-image:
  stage: build
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  tags:
    - arm-k8s
  script:
  - echo "{\"auths\":{\"camden.ornl.gov\":{\"username\":\"$REPO_ROBOT\",\"password\":\"$REPO_TOKEN\"}}}" > /kaniko/.docker/config.json
  - >
    /kaniko/executor
    --cache=true
    --context "$CI_PROJECT_DIR"
    --dockerfile Dockerfile
    --destination "$IMAGE_REPO:$CI_COMMIT_SHORT_SHA"
    --destination "$IMAGE_REPO:latest"

build_chart:
  stage: build
  image: camden.ornl.gov/hub_proxy/alpine/helm:latest
  tags:
    - arm-k8s
  needs:
  - job: chart_lint
  artifacts:
    reports:
      dotenv: chart-build.env
  before_script:
    - apk add --update --no-cache git
  script:
  - |
    CHART_VERSION=$(helm show chart helm/adl | sed -n 's/^version: \(.*\)$/\1/p')
    echo "Repo chart version is ${CHART_VERSION}"
    CHART_VERSION="${CHART_VERSION}-snapshot+${CI_COMMIT_SHORT_SHA}"
    echo "Augmented chart version is ${CHART_VERSION}"
    echo "CHART_VERSION=${CHART_VERSION}" >> chart-build.env
    helm plugin install https://github.com/chartmuseum/helm-push
    helm push helm/adl --username "${REPO_ROBOT}" --password "${REPO_TOKEN}" --version="${CHART_VERSION}" https://camden.ornl.gov/chartrepo/arm --debug

deploy:
  stage: deploy
  environment:
    name: review/$CI_BUILD_REF_NAME
    url: https://$PROJECT_NAME-$CI_BUILD_REF_SLUG.k8s.arm.gov
    on_stop: stop_review
  image: camden.ornl.gov/hub_proxy/alpine/helm:latest
  tags:
    - arm-k8s
  needs:
  - job: build_chart
    artifacts: true
  - job: build-image
  before_script:
    - apk add --update --no-cache git
  script:
  - helm repo add adl https://camden.ornl.gov/chartrepo/arm --username "$REPO_ROBOT" --password "$REPO_TOKEN"
  - helm dep update ./helm/adl
  - >
    helm upgrade $PROJECT_NAME-$CI_BUILD_REF_SLUG adl/adl
    --install
    --version ${CHART_VERSION}
    --namespace adl-review
    --debug
    --atomic
    --set config.db.username=$PGDB_USER
    --set config.db.password=$PGDB_PASS

stop_review:
  stage: deploy
  environment:
    name: review/$CI_BUILD_REF_NAME
    url: https://$PROJECT_NAME-$CI_BUILD_REF_SLUG.k8s.arm.gov
    action: stop
  image: camden.ornl.gov/hub_proxy/alpine/helm:latest
  when: manual
  only:
  - pipelines
  tags:
    - arm-k8s
  script: helm delete $PROJECT_NAME-$CI_BUILD_REF_SLUG -n adl-review

deploy:prod:
  stage: deploy
  environment:
    name: production
    url: https://api.k8s.arm.gov
  image: camden.ornl.gov/hub_proxy/alpine/helm:latest
  tags:
    - arm-k8s
  needs:
  - job: build_chart
    artifacts: true
  - job: build-image
  only:
    - master
  before_script:
    - apk add --update --no-cache git
  script:
  - >
  - helm upgrade $PROJECT_NAME https://camden.ornl.gov/chartrepo/adl -i -n $PROJECT_NAME --atomic
    --set ingress.hostname=api.k8s.arm.gov
    --set ingress.tls.secretName=ingress-cert-adi-prod

ADL/__init__.py

0 → 100644
+1 −0
Original line number Diff line number Diff line

ADL/api/__init__.py

0 → 100644
+0 −0

Empty file added.