blob: 286969673d289cebaab3010b04ba7d0fb21b432f [file] [log] [blame]
Hung-Wei Chiu99bff2f2020-09-17 13:05:31 -07001pipeline {
2 agent {
3 docker {
4 image 'ubuntu:18.04'
5 args '-u root:sudo'
6 }
7 }
8 environment {
9 KUBECONFIG = credentials("${params.k8s_config}")
10 registry_password = credentials("${params.registry_password_env}")
11 }
12 stages {
13 stage('Install tools') {
14 steps {
15 sh '''
16 set -x
17 apt-get update -y
18 apt-get install -y curl
19
20 # Install kubectl
21 curl -LO "https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/amd64/kubectl"
22 chmod +x ./kubectl
23 mv ./kubectl /usr/local/bin/kubectl
24
25 # Test Kubectl & Rancher
26 kubectl get nodes
27 '''
28 }
29 }
30 stage('Perform Terraform') {
31 steps {
32 sh """
33 kubectl -n ${target_namespace} create secret docker-registry aether-registry-credential --docker-server=${registry_server} --docker-username=${registry_user} --docker-password=${registry_password}
34 """
35 }
36 }
37 }
38 post {
39 always {
40 cleanWs()
41 }
42 }
43}