Skip to content

Instantly share code, notes, and snippets.

@manimike00
Last active June 2, 2021 19:14
Show Gist options
  • Save manimike00/efd4294f29204221e75a808b5f811754 to your computer and use it in GitHub Desktop.
Save manimike00/efd4294f29204221e75a808b5f811754 to your computer and use it in GitHub Desktop.
pipeline {
agent any
stages {
stage('Build') {
steps {
script {
if (env.BRANCH_NAME == 'test') {
sshPublisher(
publishers: [
sshPublisherDesc(
configName: "hawksighttest",
transfers: [
sshTransfer(
execCommand: "docker ps -q | xargs -r docker kill"
),
sshTransfer(
execCommand: "docker images -f dangling=true -q | xargs -r -n1 docker rmi -f"
),
sshTransfer(
execCommand: "docker-compose rm -f -v"
),
sshTransfer(
execCommand: "cd /home/ubuntu/hwk-srm-frontend/;git pull && docker-compose up --build -d"
)
])
])
} else {
echo 'Branch Not Found'
}
}
}
}
}
post {
always {
discordSend description: "Jenkins Pipeline Build", link: env.BUILD_URL, result: currentBuild.currentResult, title: JOB_NAME, webhookURL: env.hwk_srm_frontend
}
}
}
@vinayakkulkarni
Copy link

    stage('Install dependencies') {
      steps {
        echo "We are currently working on branch: ${env.BRANCH_NAME}"
        sh 'npm ci'
      }
    }

    stage('Test') {
      steps {
        sh 'npm run test'
      }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment