fixes and updates to jenkinsfile (#5370)

Signed-off-by: Shylaja Devadiga <shylaja.devadiga@suse.com>
Signed-off-by: Shylaja Devadiga <shylaja@rancher.com>
This commit is contained in:
ShylajaDevadiga 2022-04-13 08:55:05 -07:00 committed by GitHub
parent 6f8f6bb200
commit 5cb4894a50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 7 deletions

View File

@ -7,11 +7,10 @@ ENV TERRAFORM_VERSION=$TERRAFORM_VERSION
RUN apk update && \
apk upgrade --update-cache --available && \
apk add curl git jq bash openssh unzip gcc g++ make ca-certificates && \
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 && \
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && \
chmod +x ./kubectl && \
mv ./kubectl /usr/local/bin
RUN mkdir tmp && \
mv ./kubectl /usr/local/bin && \
mkdir tmp && \
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 && \
chmod +x /usr/local/bin/terraform && \

View File

@ -33,11 +33,11 @@ func BuildCluster(nodeOs, clusterType, externalDb, resourceName string, t *testi
vDir = "/config/" + nodeOs + externalDb + ".tfvars"
}
tfDir, _ := filepath.Abs(tDir)
tfDir, err := filepath.Abs(tDir)
if err != nil {
return "", "", "", err
}
varDir, _ := filepath.Abs(vDir)
varDir, err := filepath.Abs(vDir)
if err != nil {
return "", "", "", err
}

View File

@ -12,7 +12,7 @@ pipeline {
stages {
stage('Git Checkout') {
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 {
dir("${WORKSPACE}/tests/terraform") {
if (env.AWS_SSH_PEM_KEY && env.AWS_SSH_KEY_NAME) {

View File

@ -78,6 +78,10 @@ func runsshCommand(cmd string, conn *ssh.Client) (string, error) {
var stderrBuf bytes.Buffer
session.Stdout = &stdoutBuf
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
}