Migrate keygrip extraction into jenkins
Change-Id: Ibfe43bd657153731b1c080a56b8f4bdc7d4a71f1
diff --git a/cicd/pipelines/tasks/task_publish_unstable.jenkins b/cicd/pipelines/tasks/task_publish_unstable.jenkins
index b5a7e80..829eedd 100644
--- a/cicd/pipelines/tasks/task_publish_unstable.jenkins
+++ b/cicd/pipelines/tasks/task_publish_unstable.jenkins
@@ -14,6 +14,19 @@
return sh(returnStdout: true, script: "cat ${filename}").trim()
}
+String getKeygripId() {
+ def script = """
+ gpg --no-default-keyring \
+ --keyring=release-keyring.gpg \
+ --with-colons \
+ --list-secret-keys \
+ | awk -F: '$1 == "grp" { print $10 }' \
+ | head -n1
+ """
+
+ return sh(returnStdout: true, script: script).trim()
+}
+
def workspacePath = "/home/jenkins/workspace"
def buildLabel = "task.publish.unstable-${UUID.randomUUID().toString()}"
def sourcePath = "${workspacePath}/src"
@@ -40,7 +53,7 @@
def debianMirrorSnapshotName = getLatestSnapshot('debian-buster')
def coreSnapshotName = getLatestSnapshot('core-unstable')
def bspSnapshotName = getLatestSnapshot('enterprise-bsp-unstable')
- def keygripId = getFileContents('/var/lib/aptly/keyring/keygrip.txt')
+ def keygripId = getKeygripId()
def date = new Date()
String stamp = date.format("yyyyMMdd-HHmmss")