Commit dbd5aa82 authored by Thong Kuah's avatar Thong Kuah
Browse files

Merge branch '5-consider-switching-back-to-k3s-companion-service' into 'master'

Resolve "Consider switching back to `k3s` companion service"

Closes #5

See merge request gitlab-org/cluster-integration/auto-deploy-image!38
parents d6d1acd8 6f51df3d
Loading
Loading
Loading
Loading
+19 −42
Original line number Diff line number Diff line
@@ -31,9 +31,25 @@ build:
.test-job: &test-job
  stage: test
  image: "$BUILD_IMAGE_NAME"
  artifacts:
    paths:
      - k3s.log
  services:
    - name: registry.gitlab.com/gitlab-org/cluster-integration/test-utils/k3s-gitlab-ci/releases/v0.6.1
      alias: k3s
      command: ["server", "--cluster-secret", "some-secret"]
  before_script:
    - kubectl config set-cluster k3s --server https://k3s:6443 --insecure-skip-tls-verify
    - kubectl config set-credentials default --username=node --password=some-secret
    - kubectl config set-context k3s --cluster=k3s --user=default
    - kubectl config use-context k3s
    - kubectl version
    - |
        function expected_error() {
          echo "Expected error but exited with $?, failing build!"
          exit 1
        }

        function failed_as_expected() {
          echo "Failed as expected and exited with $?"
        }

test-shellcheck:
  stage: test
@@ -126,8 +142,6 @@ test-ensure-namespace:
    GIT_STRATEGY: none
    KUBE_NAMESPACE: project-123456
  script:
    - download_k3s
    - start_k3s
    - auto-deploy ensure_namespace

test-initialize-tiller:
@@ -136,8 +150,6 @@ test-initialize-tiller:
    GIT_STRATEGY: none
    KUBE_NAMESPACE: default
  script:
    - download_k3s
    - start_k3s
    - auto-deploy initialize_tiller
    - ps aufx
    - helm ls --host "localhost:44134"
@@ -153,8 +165,6 @@ test-initialize-tiller:
    CI_DEPLOY_PASSWORD: ci-deploy-password
    GITLAB_USER_EMAIL: user@example.com
  script:
    - download_k3s
    - start_k3s
    - auto-deploy create_secret
    - kubectl get secret gitlab-registry -n $KUBE_NAMESPACE

@@ -183,8 +193,6 @@ test-create-secret-public-project:
    CI_PROJECT_VISIBILITY: public
    KUBE_NAMESPACE: default
  script:
    - download_k3s
    - start_k3s
    - auto-deploy create_secret
    - kubectl get secret gitlab-registry -n $KUBE_NAMESPACE && expected_error || failed_as_expected

@@ -210,7 +218,6 @@ test-persist-environment-url:
    CI_PROJECT_VISIBILITY: public
    KUBE_NAMESPACE: default
    KUBE_INGRESS_BASE_DOMAIN: example.com
    POSTGRES_ENABLED: true
    POSTGRES_USER: user
    POSTGRES_PASSWORD: testing-password
    POSTGRES_ENABLED: "true"
@@ -231,8 +238,6 @@ test-create-application-secret:
    CI_ENVIRONMENT_SLUG: production
    K8S_SECRET_CODE: 12345
  script:
    - download_k3s
    - start_k3s
    - auto-deploy create_application_secret "stable"
    - kubectl get secrets -n $KUBE_NAMESPACE
    - kubectl get secrets production-secret -n $KUBE_NAMESPACE
@@ -255,34 +260,6 @@ release-tag:
  only:
    - tags

before_script:
  - |
    function expected_error() {
      echo "Expected error but exited with $?, failing build!"
      exit 1
    }

    function failed_as_expected() {
      echo "Failed as expected and exited with $?"
    }

    function download_k3s() {
      wget https://github.com/rancher/k3s/releases/download/v0.7.0/k3s
      chmod +x k3s
    }

    function start_k3s() {
      ./k3s server > k3s.log 2>&1 &

      until [ -f /etc/rancher/k3s/k3s.yaml ]; do
        sleep 1
        echo -n .
      done

      export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
      kubectl version
    }

publish:
  extends: .semantic-release
  only: