images: Parameterize the release to build an image from

This makes the image jobs more flexible in the long run.

Change-Id: I76120998e06fa303369f16095c4ddbd7199583ea
diff --git a/cicd/jobs/images.jenkins b/cicd/jobs/images.jenkins
index 09a5d8b..0f6ad09 100644
--- a/cicd/jobs/images.jenkins
+++ b/cicd/jobs/images.jenkins
@@ -8,9 +8,10 @@
 boards.each {
     def boardName = it
 
-    pipelineJob("image.unstable.${boardName}") {
+    pipelineJob("image.${boardName}") {
         parameters {
             stringParam('boardName', boardName, 'Board to build an image for')
+            stringParam('releaseName', 'unstable', 'The release name to build an image from')
         }
         definition {
             cpsScm {
diff --git a/cicd/pipelines/core/image_unstable.jenkins b/cicd/pipelines/core/images.jenkins
similarity index 91%
rename from cicd/pipelines/core/image_unstable.jenkins
rename to cicd/pipelines/core/images.jenkins
index 031d239..c65a656 100644
--- a/cicd/pipelines/core/image_unstable.jenkins
+++ b/cicd/pipelines/core/images.jenkins
@@ -3,8 +3,9 @@
 library 'functions'
 
 def boardName = params.boardName
+def releaseName = params.releaseName
 def workspacePath = "/home/jenkins/workspace"
-def buildLabel = "image.unstable.${boardName}-${UUID.randomUUID().toString()}"
+def buildLabel = "image.${releaseName}.${boardName}-${UUID.randomUUID().toString()}"
 def sourcePath = "${workspacePath}/src"
 
 // FIXME(jtgans): Get rid of privileged! This is a security risk!
@@ -24,7 +25,7 @@
             container('debian') {
                 def envVars = [
                     'IS_JENKINS=true',
-                    'RELEASE_NAME=unstable',
+                    "RELEASE_NAME=${releaseName}",
                     'USER=root'
                 ]
 
@@ -39,7 +40,7 @@
                     }
 
                     stage('Deploy') {
-                        def imagePath = "/var/lib/aptly/images/${boardName}/unstable"
+                        def imagePath = "/var/lib/aptly/images/${boardName}/${releaseName}"
                         def files = findFiles(glob: "out/**/dist/*")
 
                         if (files.size() == 0) {