mirror of https://github.com/k3s-io/k3s
fixes and updates to jenkinsfile (#5370)
Signed-off-by: Shylaja Devadiga <shylaja.devadiga@suse.com> Signed-off-by: Shylaja Devadiga <shylaja@rancher.com>pull/5373/head
parent
6f8f6bb200
commit
5cb4894a50
|
@ -7,11 +7,10 @@ ENV TERRAFORM_VERSION=$TERRAFORM_VERSION
|
||||||
RUN apk update && \
|
RUN apk update && \
|
||||||
apk upgrade --update-cache --available && \
|
apk upgrade --update-cache --available && \
|
||||||
apk add curl git jq bash openssh unzip gcc g++ make ca-certificates && \
|
apk add curl git jq bash openssh unzip gcc g++ make ca-certificates && \
|
||||||
|
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && \
|
||||||
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && \
|
|
||||||
chmod +x ./kubectl && \
|
chmod +x ./kubectl && \
|
||||||
mv ./kubectl /usr/local/bin
|
mv ./kubectl /usr/local/bin && \
|
||||||
RUN mkdir tmp && \
|
mkdir tmp && \
|
||||||
curl "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" -o tmp/terraform.zip && \
|
curl "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" -o tmp/terraform.zip && \
|
||||||
unzip tmp/terraform.zip -d /usr/local/bin && \
|
unzip tmp/terraform.zip -d /usr/local/bin && \
|
||||||
chmod +x /usr/local/bin/terraform && \
|
chmod +x /usr/local/bin/terraform && \
|
||||||
|
|
|
@ -33,11 +33,11 @@ func BuildCluster(nodeOs, clusterType, externalDb, resourceName string, t *testi
|
||||||
vDir = "/config/" + nodeOs + externalDb + ".tfvars"
|
vDir = "/config/" + nodeOs + externalDb + ".tfvars"
|
||||||
}
|
}
|
||||||
|
|
||||||
tfDir, _ := filepath.Abs(tDir)
|
tfDir, err := filepath.Abs(tDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", "", err
|
return "", "", "", err
|
||||||
}
|
}
|
||||||
varDir, _ := filepath.Abs(vDir)
|
varDir, err := filepath.Abs(vDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", "", err
|
return "", "", "", err
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ pipeline {
|
||||||
stages {
|
stages {
|
||||||
stage('Git Checkout') {
|
stage('Git Checkout') {
|
||||||
steps {
|
steps {
|
||||||
git branch: 'add_automation_using_tf', url: 'https://github.com/ShylajaDevadiga/k3s.git'
|
git branch: 'master', url: 'https://github.com/k3s-io/k3s.git'
|
||||||
script {
|
script {
|
||||||
dir("${WORKSPACE}/tests/terraform") {
|
dir("${WORKSPACE}/tests/terraform") {
|
||||||
if (env.AWS_SSH_PEM_KEY && env.AWS_SSH_KEY_NAME) {
|
if (env.AWS_SSH_PEM_KEY && env.AWS_SSH_KEY_NAME) {
|
||||||
|
|
|
@ -78,6 +78,10 @@ func runsshCommand(cmd string, conn *ssh.Client) (string, error) {
|
||||||
var stderrBuf bytes.Buffer
|
var stderrBuf bytes.Buffer
|
||||||
session.Stdout = &stdoutBuf
|
session.Stdout = &stdoutBuf
|
||||||
session.Stderr = &stderrBuf
|
session.Stderr = &stderrBuf
|
||||||
|
if err := session.Run(cmd); err != nil {
|
||||||
|
log.Println(session.Stdout)
|
||||||
|
log.Fatal("Error on command execution", err.Error())
|
||||||
|
}
|
||||||
return fmt.Sprintf("%s", stdoutBuf.String()), err
|
return fmt.Sprintf("%s", stdoutBuf.String()), err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue