forked from mendersoftware/mender-helm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
72 lines (67 loc) · 2.31 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
stages:
- build
- test
include:
- project: 'Northern.tech/Mender/mendertesting'
file: '.gitlab-ci-check-commits-signoffs.yml'
- project: 'Northern.tech/Mender/mendertesting'
file: '.gitlab-ci-check-license.yml'
- project: 'Northern.tech/Mender/mendertesting'
file: '.gitlab-ci-github-status-updates.yml'
build:
stage: build
image: debian:buster
before_script:
- apt-get update -y
- apt-get install -y curl make
- curl -L https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | DESIRED_VERSION="v3.8.2" bash
script:
- make lint
- make package
artifacts:
expire_in: 2w
paths:
- mender-*.tgz
.get_kubectl_and_tools: &get_kubectl_and_tools |
# Install kubectl
apt update && apt install -yyq curl
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.23.6/bin/linux/amd64/kubectl
chmod +x ./kubectl
mv ./kubectl /usr/local/bin/kubectl
# Install AWS CLI and aws-iam-authenticator
apt install -yyq awscli
curl -o aws-iam-authenticator https://amazon-eks.s3.us-west-2.amazonaws.com/1.15.10/2020-02-22/bin/linux/amd64/aws-iam-authenticator
chmod +x ./aws-iam-authenticator
mv ./aws-iam-authenticator /usr/local/bin/aws-iam-authenticator
# Install kubectx
apt install -yyq kubectx
.setup_eks_cluster_staging: &setup_eks_cluster_staging |
# Configure AWS CLI for staging cluster
export AWS_ACCESS_KEY_ID=$CI_JOBS_AWS_ACCESS_KEY_ID_STAGING
export AWS_SECRET_ACCESS_KEY=$CI_JOBS_AWS_SECRET_ACCESS_KEY_STAGING
export AWS_DEFAULT_REGION=$CI_JOBS_AWS_REGION_STAGING
aws eks --region $CI_JOBS_AWS_REGION_STAGING update-kubeconfig --name $CI_JOBS_AWS_EKS_CLUSTER_NAME_STAGING
kubens mender-helm-tests
test:helm_chart_install:
rules:
- if: '$CI_COMMIT_BRANCH == "master" || $RUN_HELM_CHART_INSTALL == "true"'
stage: test
dependencies:
- build
image: debian:buster
before_script:
- *get_kubectl_and_tools
- *setup_eks_cluster_staging
# Install test dependencies
- apt install -yyq make uuid-runtime
- tests/ci-deps-k8s.sh
# Clean possible leftovers from an unfinished run
- tests/ci-test-teardown.sh || true
- tests/ci-make-clean.sh || true
script:
- tests/ci-make-deps.sh
- tests/ci-make-helm.sh
- make test
after_script:
- *setup_eks_cluster_staging
- tests/ci-make-clean.sh