From 1d35892e87b5a49bc45eb6ff7c81289d6ac01f4d Mon Sep 17 00:00:00 2001 From: Matthieu Lamalle Date: Tue, 18 Apr 2023 16:09:00 +0200 Subject: [PATCH] podman correction --- vars/podman.groovy | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/vars/podman.groovy b/vars/podman.groovy index 87c3241..2335f12 100644 --- a/vars/podman.groovy +++ b/vars/podman.groovy @@ -1,28 +1,26 @@ -void buildCadolesPodPackage(String imageName, String imageTag, Map options = [:]) { +String buildCadolesPodPackage(String imageName, String imageTag, Map options = [:]) { String destDir = options.get('destDir', env.WORKSPACE + '/dist') Map nfpmOptions = options.get('nfpmOptions', [:]) nfpmOptions['target'] = destDir Map env = options.get('env', [:]) - env['IMAGE_NAME'] = imageName env['IMAGE_TAG'] = imageTag - withPodmanPackagingTempDir { + return withPodmanPackagingTempDir { gomplate('post-install.sh.gotmpl', 'post-install.sh', env) gomplate('pod.service.gotmpl', 'pod.service', env) gomplate('pod.conf.gotmpl', 'pod.conf', env) gomplate('nfpm.yaml.gotmpl', 'nfpm.yaml', env) - nfpm(nfpmOptions) } } void withPodmanPackagingTempDir(Closure fn) { File tempDir = File.createTempDir() - tempDir.deleteOnExit() + tempDir.deleteOnExit() tempDir.mkdirs() dir(tempDir.getAbsolutePath()) { @@ -32,13 +30,11 @@ void withPodmanPackagingTempDir(Closure fn) { 'com/cadoles/podman/pod.service.gotmpl', 'com/cadoles/podman/post-install.sh.gotmpl', ] - for (res in resources) { String fileContent = libraryResource res String fileName = res.substring(res.lastIndexOf('/') + 1) writeFile file:fileName, text:fileContent } - fn() } }