updated kaniko task with the cleanup afterwards.
authorErik Brakkee <erik@brakkee.org>
Sun, 17 Nov 2024 18:58:25 +0000 (19:58 +0100)
committerErik Brakkee <erik@brakkee.org>
Sun, 17 Nov 2024 18:58:25 +0000 (19:58 +0100)
vars/buildcontainer.groovy

index 69763ce4bc3f22d574135afda7d664c4e684b5cf..f7d6d94904bd59ecea85d02c7dd87387ac4570cd 100644 (file)
 def call(Map args) { 
   def defaults = [ 
     cache: true, 
-    cachettl: "100000h",
+    cachettl: "14d",
     dockerfile: 'Dockerfile', 
     repo: env.CONTAINER_REGISTRY,
-    version: env.BRANCH_NAME
+    version: env.BRANCH_NAME + "-latest"
   ]
   args = defaults << args
   container('kaniko') { 
     sh """
       echo "Building container with settings: ${args}"
       /kaniko/executor --dockerfile ${args.dockerfile} --cache=${args.cache} --cache-ttl=${args.cachettl} --context \$(  pwd )/${args.context} --destination ${args.repo}/${args.container}:${args.version}
+      rm -rf /kaniko/*[0-9]* && rm -rf /kaniko/Dockerfile && mkdir -p /workspace
     """
   }
 }