This is an automated email from the ASF dual-hosted git repository.

msciabarra pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/openserverless-operator.git


The following commit(s) were added to refs/heads/main by this push:
     new 307f6b9  parametrized kaniko
307f6b9 is described below

commit 307f6b9b8119d5c11cd8505f9e4feaa1fb7313a5
Author: Michele Sciabarra <[email protected]>
AuthorDate: Fri Jul 12 10:14:15 2024 +0200

    parametrized kaniko
---
 .env.dist    |  1 +
 .gitignore   |  3 +++
 Taskfile.yml | 26 +++++++++++++++++++++++---
 kaniko.yaml  |  6 +++---
 4 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/.env.dist b/.env.dist
new file mode 100644
index 0000000..072d08a
--- /dev/null
+++ b/.env.dist
@@ -0,0 +1 @@
+GITHUB_USER=github: put here your github user
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0d82491
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+.env
+_*
+
diff --git a/Taskfile.yml b/Taskfile.yml
index f3a61e6..e082a4d 100644
--- a/Taskfile.yml
+++ b/Taskfile.yml
@@ -1,11 +1,31 @@
 version: 3
+vars:
+ BASETAG: 0.1-dev
+ TAG:
+    sh: git describe --tags --abbrev=0 2>/dev/null || echo latest
+
+dotenv: 
+  - .env
 
 tasks:
 
+  tag: 
+    silent: true
+    cmds:
+    - git tag -d $(git tag) 
+    - git tag -f {{.BASETAG}}.$(date +%y%m%d%H%M)
+    - env PAGER= git tag
+
   install-registry:
     - helm repo add twuni https://helm.twun.io
     - helm install docker-registry twuni/docker-registry --namespace default
 
-  build-dockerfile:
-    - kubectl -n default create configmap dockerfile-configmap 
--from-file=Dockerfile
-    - kubectl apply -f kaniko.yaml
\ No newline at end of file
+  build:
+    env:
+      TAG: "{{.TAG}}"
+    cmds:
+    - test -n "$GITHUB_USER" || true "did you configure your .env?"
+    - envsubst  <kaniko.yaml >_kaniko.yaml
+    - cat _kaniko.yaml
+    #- kubectl -n default create configmap dockerfile-configmap 
--from-file=Dockerfile
+    #- kubectl apply -f kaniko.yaml
\ No newline at end of file
diff --git a/kaniko.yaml b/kaniko.yaml
index dcc9150..eeac3f4 100644
--- a/kaniko.yaml
+++ b/kaniko.yaml
@@ -12,8 +12,8 @@ spec:
     #- inf
     image: gcr.io/kaniko-project/executor:latest
     args: 
-      - --context=dir:///context/"
-      - --destination=docker-registry:5000/openserverless/operator:latest
+      - --context=git://github.com/${GITHUB_USER}/openserverless-operator
+      - --destination=docker-registry:5000/openserverless/operator:${TAG}
       - --insecure
       - --insecure-registry=docker-registry
     volumeMounts:
@@ -23,4 +23,4 @@ spec:
   volumes:
   - name: config-volume
     configMap:
-      name: dockerfile-configmap
\ No newline at end of file
+      name: dockerfile-configmap

Reply via email to