ci/publish.groovy
branchstx-8.0.0
changeset 223 575d0458b5c0
child 229 08322591d2b1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ci/publish.groovy	Thu Mar 15 09:44:04 2018 +0000
@@ -0,0 +1,47 @@
+/*
+ * This is a publish pipeline
+ */
+
+
+pipeline {
+    agent any
+
+    parameters {
+        string(name: 'job', description: 'Job whose artifacts to upload',  defaultValue: 'stx_jv')
+        string(name: 'srv', description: 'Server (and username) where to upload artifacts',  defaultValue: "${env.STX_PUBLISH_SERVER}")
+        string(name: 'dir', description: 'Directory where to upload artifacts  ',  defaultValue: "${env.STX_PUBLISH_DIRECTORY}/6.2.6")
+    }
+
+    stages {
+        stage('Copy artifacts') {
+            steps {
+                copyArtifacts projectName: "${params.job}", selector: lastSuccessful(), excludes: '**/*prebuilt*'
+                sh "ls -al artifacts"
+            }
+        }
+
+        stage ( "Upload artifacts" ) {
+            steps {
+                sshagent([ "8be01219-a51e-410a-9850-bf9c134283fb" ]) {
+                    sh script:
+                        """
+                        sftp -b - ${params.srv} <<END
+                        cd ${params.dir}
+                        ls
+                        rm *
+                        put artifacts/*
+                        ls
+                        END
+                        """.stripIndent()
+                }
+            }
+        }
+        stage ( "Cleanup" ) {
+            steps {
+                cleanWs()
+            }
+        }
+    }
+}
+
+