message: Moved steps into functions
diff: @@ -17,15 +17,36 @@ node('ubuntu') {
  stage ('Checkout'){
  checkout scm
  }
  + app = buildDocker()
  + buildRust(app)
  + createZip(app)
  + testRust(app)
  + testNodeWrapper(app)
  + createZip(app)
  + } catch (Exception ex) {
  + currentBuild.result = "FAILED"
  + echo "$ex error"
  + } finally {
  +
  + step([$class: 'WsCleanup'])
  +
  + }
  +}
  +
  +def buildDocker(){
  + var app
  stage ('Build docker environment'){
  sh "pwd"
  sh "ls ${pathToCi}"
  sh "echo building"
  app = build('cxs')
  -
  }
  + return app
  +}
  +
  +def buildRust(envn){
  stage ('Building'){
  - app.inside {
  + envn.inside {
  sh "rustc --version"
  sh "gcc --version"
  sh "mkdir -p cxs/wrappers/node/lib"
  @@ -34,31 +55,24 @@ node('ubuntu') {
  sh "ls cxs/wrappers/node/lib"
  }
  }
  - stage ('Testing'){
  +}
  +
  +def testRust(envn) {
  + stage ('Testing Rust'){
  sh "echo Testing"
  - app.inside {
  + envn.inside {
  sh "cd cxs/libcxs; cargo test -- --test-threads=1"
  }
  }
  -
  - testNodeWrapper(app)
  - createZip(app)
  - } catch (Exception ex) {
  - currentBuild.result = "FAILED"
  - echo "$ex error"
  - } finally {
  -
  - step([$class: 'WsCleanup'])
  -
  - }
  }
  +
  def createZip(envn) {
  dir ('cxs/libcxs'){
  stage ('Create Zip File') {
  envn.inside {
  sh 'tar -cf libcxs.tar target/debug/libcxs.so'
  - archiveArtifacts allowEmptyArchive: true, artifacts: libcxs.tar
  + archiveArtifacts allowEmptyArchive: true, artifacts: 'libcxs.tar'
  }
  }
  }
  