From 367a816cade114e7c7dea85520f84d444f4ed7d6 Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Mon, 22 Jun 2026 19:56:35 +0700 Subject: feat: jenkinsfile for local jenkins server --- Dockerfile | 4 ++-- Jenkinsfile | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 Jenkinsfile diff --git a/Dockerfile b/Dockerfile index 44d1ea2..58ba7f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.26-alpine3.23 AS build-stage +FROM golang:1.26.4-alpine3.24 AS build-stage RUN apk add --no-cache sqlite-dev musl-dev gcc @@ -7,7 +7,7 @@ COPY . . RUN go mod download RUN CGO_ENABLED=1 go build -o sayana-web . -FROM alpine:3.23 AS runtime-stage +FROM alpine:3.24 AS runtime-stage ENV ENVIRONMENT="" ENV AUTH_SALT="" diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..3153b53 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,64 @@ +pipeline { + agent none + + stages { + stage('Compile Tailwind CSS') { + agent { + docker { + image 'node:26.3.1-alpine3.24' + args '-v /tmp:/tmp' + } + } + steps { + checkout scm + sh ''' + npm install tailwindcss @tailwindcss/cli + npx tailwindcss -i static/input.css -o static/output.css --watch + ''' + stash name: 'tailwindcss-output', includes: 'static/output.css' + } + } + + stage('Build') { + agent { + kubernetes { + defaultContainer 'kaniko' + yaml """ +apiVersion: v1 +kind: Pod +metadata: + name: kaniko +spec: + containers: + - name: kaniko + image: gcr.io/kaniko-project/executor:debug-v1.24.0 + imagePullPolicy: Always + command: [ /busybox/cat ] + tty: true +""" + } + } + environment { + IMAGE_PUSH_DESTINATION="registry.sayag.it/sayauz/web" + } + steps { + checkout scm + unstash 'tailwindcss-output' + container(name: 'kaniko', shell: '/busybox/sh') { + withCredentials([file(credentialsId: 'registry-sayagit-jenkins-password', variable: 'REGISTRY_SAYAGIT_JENKINS_PASSWORD')]) { + withEnv(['PATH+EXTRA=/busybox']) { + sh '''#!/busybox/sh + docker login registry.sayag.it -u jenkins -p "$REGISTRY_SAYAGIT_JENKINS_PASSWORD" + pushToTags="$IMAGE_PUSH_DESTINATION:latest $IMAGE_PUSH_DESTINATION:commit-`git rev-parse --short HEAD`" + if [ "$TAG_NAME" != "" ]; then + pushToTags="$pushToTags $IMAGE_PUSH_DESTINATION:stable $IMAGE_PUSH_DESTINATION:$TAG_NAME" + fi + /kaniko/executor --context `pwd` --destination $pushToTags + ''' + } + } + } + } + } + } +} -- cgit v1.3.1+13 From b305fef2b1cf242e93440270a2054cc9523a3574 Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Mon, 22 Jun 2026 20:23:25 +0700 Subject: fix(ci): mount npm cache --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3153b53..d598773 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,7 +6,7 @@ pipeline { agent { docker { image 'node:26.3.1-alpine3.24' - args '-v /tmp:/tmp' + args '-v /tmp:/tmp -v /.npm:/.npm' } } steps { -- cgit v1.3.1+13 From ce00fdd605784adc5b71ad55251f5ac7d6622649 Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Mon, 22 Jun 2026 20:26:49 +0700 Subject: fix: add tailwindcss/forms install --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d598773..96549ad 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,7 +12,7 @@ pipeline { steps { checkout scm sh ''' - npm install tailwindcss @tailwindcss/cli + npm install tailwindcss @tailwindcss/cli @tailwindcss/forms npx tailwindcss -i static/input.css -o static/output.css --watch ''' stash name: 'tailwindcss-output', includes: 'static/output.css' -- cgit v1.3.1+13 From 2f89476fd1fa9fe51fe1c9d76b17b5cf994d2ad0 Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Mon, 22 Jun 2026 21:09:43 +0700 Subject: fix: executor debug tag --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 96549ad..7cab0dd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,7 +31,7 @@ metadata: spec: containers: - name: kaniko - image: gcr.io/kaniko-project/executor:debug-v1.24.0 + image: gcr.io/kaniko-project/executor:v1.24.0-debug imagePullPolicy: Always command: [ /busybox/cat ] tty: true -- cgit v1.3.1+13 From ed128d7e9b9df47fb3ee9e54817fef18f63f5feb Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Mon, 22 Jun 2026 21:13:55 +0700 Subject: fix: specify namespace for kaniko pod --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7cab0dd..1eb8b20 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,7 +27,8 @@ pipeline { apiVersion: v1 kind: Pod metadata: - name: kaniko + name: kaniko-sayauz-web + namespace: jenkins spec: containers: - name: kaniko -- cgit v1.3.1+13 From 7737b91fccbff3da84342a6974df35ee59737dcb Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Mon, 22 Jun 2026 21:18:36 +0700 Subject: fix: use docker.json for auth --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1eb8b20..586cd0e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -49,7 +49,8 @@ spec: withCredentials([file(credentialsId: 'registry-sayagit-jenkins-password', variable: 'REGISTRY_SAYAGIT_JENKINS_PASSWORD')]) { withEnv(['PATH+EXTRA=/busybox']) { sh '''#!/busybox/sh - docker login registry.sayag.it -u jenkins -p "$REGISTRY_SAYAGIT_JENKINS_PASSWORD" + mkdir -p /kaniko/.docker + echo "{\"auths\":{\"https://registry.sayag.it\":{\"username\":\"jenkins\",\"password\":\"$REGISTRY_SAYAGIT_JENKINS_PASSWORD\"}}}" > /kaniko/.docker/config.json pushToTags="$IMAGE_PUSH_DESTINATION:latest $IMAGE_PUSH_DESTINATION:commit-`git rev-parse --short HEAD`" if [ "$TAG_NAME" != "" ]; then pushToTags="$pushToTags $IMAGE_PUSH_DESTINATION:stable $IMAGE_PUSH_DESTINATION:$TAG_NAME" -- cgit v1.3.1+13 From 1c54aa1c4d87966e37dda72630642943a022b09c Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Mon, 22 Jun 2026 21:24:00 +0700 Subject: fix: try to catch exception on build step --- Jenkinsfile | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 586cd0e..f565210 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -48,15 +48,21 @@ spec: container(name: 'kaniko', shell: '/busybox/sh') { withCredentials([file(credentialsId: 'registry-sayagit-jenkins-password', variable: 'REGISTRY_SAYAGIT_JENKINS_PASSWORD')]) { withEnv(['PATH+EXTRA=/busybox']) { - sh '''#!/busybox/sh - mkdir -p /kaniko/.docker - echo "{\"auths\":{\"https://registry.sayag.it\":{\"username\":\"jenkins\",\"password\":\"$REGISTRY_SAYAGIT_JENKINS_PASSWORD\"}}}" > /kaniko/.docker/config.json - pushToTags="$IMAGE_PUSH_DESTINATION:latest $IMAGE_PUSH_DESTINATION:commit-`git rev-parse --short HEAD`" - if [ "$TAG_NAME" != "" ]; then - pushToTags="$pushToTags $IMAGE_PUSH_DESTINATION:stable $IMAGE_PUSH_DESTINATION:$TAG_NAME" - fi - /kaniko/executor --context `pwd` --destination $pushToTags - ''' + try { + sh '''#!/busybox/sh + mkdir -p /kaniko/.docker + echo "{\"auths\":{\"https://registry.sayag.it\":{\"username\":\"jenkins\",\"password\":\"$REGISTRY_SAYAGIT_JENKINS_PASSWORD\"}}}" > /kaniko/.docker/config.json + pushToTags="$IMAGE_PUSH_DESTINATION:latest $IMAGE_PUSH_DESTINATION:commit-`git rev-parse --short HEAD`" + if [ "$TAG_NAME" != "" ]; then + pushToTags="$pushToTags $IMAGE_PUSH_DESTINATION:stable $IMAGE_PUSH_DESTINATION:$TAG_NAME" + fi + /kaniko/executor --context `pwd` --destination $pushToTags + ''' + } catch (Exception e) { + echo "Caught exception: ${e.getMessage()}" + currentBuild.result = 'FAILURE' + throw e + } } } } -- cgit v1.3.1+13 From 1ce3d644faf8e0372cc63f7fb3b15a33a94cd7f4 Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Mon, 22 Jun 2026 21:30:55 +0700 Subject: feat: build image both for amd64 and arm64 --- Dockerfile | 3 ++ Jenkinsfile | 98 +++++++++++++++++++++++++++++++++++-------------------------- 2 files changed, 60 insertions(+), 41 deletions(-) diff --git a/Dockerfile b/Dockerfile index 58ba7f4..37fe431 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,8 @@ FROM golang:1.26.4-alpine3.24 AS build-stage +ENV GOOS=linux +ENV GOARCH=amd64 + RUN apk add --no-cache sqlite-dev musl-dev gcc WORKDIR /builddir diff --git a/Jenkinsfile b/Jenkinsfile index f565210..3bafa38 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,50 +18,66 @@ pipeline { stash name: 'tailwindcss-output', includes: 'static/output.css' } } - + stage('Build') { - agent { - kubernetes { - defaultContainer 'kaniko' - yaml """ -apiVersion: v1 -kind: Pod -metadata: - name: kaniko-sayauz-web - namespace: jenkins -spec: - containers: - - name: kaniko - image: gcr.io/kaniko-project/executor:v1.24.0-debug - imagePullPolicy: Always - command: [ /busybox/cat ] - tty: true -""" + matrix { + axes { + axis { + name 'GOOS' + values 'linux' + } + axis { + name 'GOARCH' + values 'arm64', 'amd64' + } } } - environment { - IMAGE_PUSH_DESTINATION="registry.sayag.it/sayauz/web" - } - steps { - checkout scm - unstash 'tailwindcss-output' - container(name: 'kaniko', shell: '/busybox/sh') { - withCredentials([file(credentialsId: 'registry-sayagit-jenkins-password', variable: 'REGISTRY_SAYAGIT_JENKINS_PASSWORD')]) { - withEnv(['PATH+EXTRA=/busybox']) { - try { - sh '''#!/busybox/sh - mkdir -p /kaniko/.docker - echo "{\"auths\":{\"https://registry.sayag.it\":{\"username\":\"jenkins\",\"password\":\"$REGISTRY_SAYAGIT_JENKINS_PASSWORD\"}}}" > /kaniko/.docker/config.json - pushToTags="$IMAGE_PUSH_DESTINATION:latest $IMAGE_PUSH_DESTINATION:commit-`git rev-parse --short HEAD`" - if [ "$TAG_NAME" != "" ]; then - pushToTags="$pushToTags $IMAGE_PUSH_DESTINATION:stable $IMAGE_PUSH_DESTINATION:$TAG_NAME" - fi - /kaniko/executor --context `pwd` --destination $pushToTags - ''' - } catch (Exception e) { - echo "Caught exception: ${e.getMessage()}" - currentBuild.result = 'FAILURE' - throw e + stages { + stage('Build') { + agent { + kubernetes { + defaultContainer 'kaniko' + yaml """ + apiVersion: v1 + kind: Pod + metadata: + name: kaniko-sayauz-web + namespace: jenkins + spec: + containers: + - name: kaniko + image: gcr.io/kaniko-project/executor:v1.24.0-debug + imagePullPolicy: Always + command: [ /busybox/cat ] + tty: true + """ + } + } + environment { + IMAGE_PUSH_DESTINATION="registry.sayag.it/sayauz/web" + } + steps { + checkout scm + unstash 'tailwindcss-output' + container(name: 'kaniko', shell: '/busybox/sh') { + withCredentials([file(credentialsId: 'registry-sayagit-jenkins-password', variable: 'REGISTRY_SAYAGIT_JENKINS_PASSWORD')]) { + withEnv(['PATH+EXTRA=/busybox']) { + try { + sh '''#!/busybox/sh + mkdir -p /kaniko/.docker + echo "{\"auths\":{\"https://registry.sayag.it\":{\"username\":\"jenkins\",\"password\":\"$REGISTRY_SAYAGIT_JENKINS_PASSWORD\"}}}" > /kaniko/.docker/config.json + pushToTags="$IMAGE_PUSH_DESTINATION:latest $IMAGE_PUSH_DESTINATION:commit-`git rev-parse --short HEAD`" + if [ "$TAG_NAME" != "" ]; then + pushToTags="$pushToTags $IMAGE_PUSH_DESTINATION:stable $IMAGE_PUSH_DESTINATION:$TAG_NAME" + fi + /kaniko/executor --context `pwd` --custom-platform=${GOOS}/${GOARCH} --destination $pushToTags + ''' + } catch (Exception e) { + echo "Caught exception: ${e.getMessage()}" + currentBuild.result = 'FAILURE' + throw e + } + } } } } -- cgit v1.3.1+13 From 772e30e41396a9a0b37001e822433027d1467577 Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Mon, 22 Jun 2026 21:32:01 +0700 Subject: fix: yaml indent of kaniko pod --- Jenkinsfile | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3bafa38..9966292 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -38,19 +38,19 @@ pipeline { kubernetes { defaultContainer 'kaniko' yaml """ - apiVersion: v1 - kind: Pod - metadata: - name: kaniko-sayauz-web - namespace: jenkins - spec: - containers: - - name: kaniko - image: gcr.io/kaniko-project/executor:v1.24.0-debug - imagePullPolicy: Always - command: [ /busybox/cat ] - tty: true - """ +apiVersion: v1 +kind: Pod +metadata: + name: kaniko-sayauz-web + namespace: jenkins +spec: + containers: + - name: kaniko + image: gcr.io/kaniko-project/executor:v1.24.0-debug + imagePullPolicy: Always + command: [ /busybox/cat ] + tty: true +""" } } environment { -- cgit v1.3.1+13 From 68dd0abd30e6013dcff44ff3549f6799a4f96549 Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Mon, 22 Jun 2026 21:33:44 +0700 Subject: fix: remove child stage --- Jenkinsfile | 62 +++++++++++++++++++++++++++++-------------------------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9966292..516b8c0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,12 +32,10 @@ pipeline { } } } - stages { - stage('Build') { - agent { - kubernetes { - defaultContainer 'kaniko' - yaml """ + agent { + kubernetes { + defaultContainer 'kaniko' + yaml """ apiVersion: v1 kind: Pod metadata: @@ -51,33 +49,31 @@ spec: command: [ /busybox/cat ] tty: true """ - } - } - environment { - IMAGE_PUSH_DESTINATION="registry.sayag.it/sayauz/web" - } - steps { - checkout scm - unstash 'tailwindcss-output' - container(name: 'kaniko', shell: '/busybox/sh') { - withCredentials([file(credentialsId: 'registry-sayagit-jenkins-password', variable: 'REGISTRY_SAYAGIT_JENKINS_PASSWORD')]) { - withEnv(['PATH+EXTRA=/busybox']) { - try { - sh '''#!/busybox/sh - mkdir -p /kaniko/.docker - echo "{\"auths\":{\"https://registry.sayag.it\":{\"username\":\"jenkins\",\"password\":\"$REGISTRY_SAYAGIT_JENKINS_PASSWORD\"}}}" > /kaniko/.docker/config.json - pushToTags="$IMAGE_PUSH_DESTINATION:latest $IMAGE_PUSH_DESTINATION:commit-`git rev-parse --short HEAD`" - if [ "$TAG_NAME" != "" ]; then - pushToTags="$pushToTags $IMAGE_PUSH_DESTINATION:stable $IMAGE_PUSH_DESTINATION:$TAG_NAME" - fi - /kaniko/executor --context `pwd` --custom-platform=${GOOS}/${GOARCH} --destination $pushToTags - ''' - } catch (Exception e) { - echo "Caught exception: ${e.getMessage()}" - currentBuild.result = 'FAILURE' - throw e - } - } + } + } + environment { + IMAGE_PUSH_DESTINATION="registry.sayag.it/sayauz/web" + } + steps { + checkout scm + unstash 'tailwindcss-output' + container(name: 'kaniko', shell: '/busybox/sh') { + withCredentials([file(credentialsId: 'registry-sayagit-jenkins-password', variable: 'REGISTRY_SAYAGIT_JENKINS_PASSWORD')]) { + withEnv(['PATH+EXTRA=/busybox']) { + try { + sh '''#!/busybox/sh + mkdir -p /kaniko/.docker + echo "{\"auths\":{\"https://registry.sayag.it\":{\"username\":\"jenkins\",\"password\":\"$REGISTRY_SAYAGIT_JENKINS_PASSWORD\"}}}" > /kaniko/.docker/config.json + pushToTags="$IMAGE_PUSH_DESTINATION:latest $IMAGE_PUSH_DESTINATION:commit-`git rev-parse --short HEAD`" + if [ "$TAG_NAME" != "" ]; then + pushToTags="$pushToTags $IMAGE_PUSH_DESTINATION:stable $IMAGE_PUSH_DESTINATION:$TAG_NAME" + fi + /kaniko/executor --context `pwd` --custom-platform=${GOOS}/${GOARCH} --destination $pushToTags + ''' + } catch (Exception e) { + echo "Caught exception: ${e.getMessage()}" + currentBuild.result = 'FAILURE' + throw e } } } -- cgit v1.3.1+13 From d45f13765e0f45ca4d714ee9becca9f1b316b380 Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Mon, 22 Jun 2026 21:39:43 +0700 Subject: fix: jenkins linting errors --- Jenkinsfile | 66 +++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 516b8c0..55fbc6c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,11 +31,12 @@ pipeline { values 'arm64', 'amd64' } } - } - agent { - kubernetes { - defaultContainer 'kaniko' - yaml """ + stages { + stage('Build') { + agent { + kubernetes { + defaultContainer 'kaniko' + yaml """ apiVersion: v1 kind: Pod metadata: @@ -49,31 +50,36 @@ spec: command: [ /busybox/cat ] tty: true """ - } - } - environment { - IMAGE_PUSH_DESTINATION="registry.sayag.it/sayauz/web" - } - steps { - checkout scm - unstash 'tailwindcss-output' - container(name: 'kaniko', shell: '/busybox/sh') { - withCredentials([file(credentialsId: 'registry-sayagit-jenkins-password', variable: 'REGISTRY_SAYAGIT_JENKINS_PASSWORD')]) { - withEnv(['PATH+EXTRA=/busybox']) { - try { - sh '''#!/busybox/sh - mkdir -p /kaniko/.docker - echo "{\"auths\":{\"https://registry.sayag.it\":{\"username\":\"jenkins\",\"password\":\"$REGISTRY_SAYAGIT_JENKINS_PASSWORD\"}}}" > /kaniko/.docker/config.json - pushToTags="$IMAGE_PUSH_DESTINATION:latest $IMAGE_PUSH_DESTINATION:commit-`git rev-parse --short HEAD`" - if [ "$TAG_NAME" != "" ]; then - pushToTags="$pushToTags $IMAGE_PUSH_DESTINATION:stable $IMAGE_PUSH_DESTINATION:$TAG_NAME" - fi - /kaniko/executor --context `pwd` --custom-platform=${GOOS}/${GOARCH} --destination $pushToTags - ''' - } catch (Exception e) { - echo "Caught exception: ${e.getMessage()}" - currentBuild.result = 'FAILURE' - throw e + } + } + environment { + IMAGE_PUSH_DESTINATION="registry.sayag.it/sayauz/web" + } + steps { + checkout scm + unstash 'tailwindcss-output' + container(name: 'kaniko', shell: '/busybox/sh') { + withCredentials([file(credentialsId: 'registry-sayagit-jenkins-password', variable: 'REGISTRY_SAYAGIT_JENKINS_PASSWORD')]) { + withEnv(['PATH+EXTRA=/busybox']) { + script { + try { + sh '''#!/busybox/sh + mkdir -p /kaniko/.docker + echo "{\"auths\":{\"https://registry.sayag.it\":{\"username\":\"jenkins\",\"password\":\"$REGISTRY_SAYAGIT_JENKINS_PASSWORD\"}}}" > /kaniko/.docker/config.json + pushToTags="$IMAGE_PUSH_DESTINATION:latest $IMAGE_PUSH_DESTINATION:commit-`git rev-parse --short HEAD`" + if [ "$TAG_NAME" != "" ]; then + pushToTags="$pushToTags $IMAGE_PUSH_DESTINATION:stable $IMAGE_PUSH_DESTINATION:$TAG_NAME" + fi + /kaniko/executor --context `pwd` --custom-platform=${GOOS}/${GOARCH} --destination $pushToTags + ''' + } catch (Exception e) { + echo "Caught exception: ${e.getMessage()}" + currentBuild.result = 'FAILURE' + throw e + } + } + } + } } } } -- cgit v1.3.1+13 From 2cd4d07ae677bb79aaca144c87c4ee021fac8078 Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Mon, 22 Jun 2026 21:47:33 +0700 Subject: fix: hardcoded name of the kaniko pod --- Jenkinsfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 55fbc6c..2eb561b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,13 +13,13 @@ pipeline { checkout scm sh ''' npm install tailwindcss @tailwindcss/cli @tailwindcss/forms - npx tailwindcss -i static/input.css -o static/output.css --watch + npx tailwindcss -i static/input.css -o static/output.css --minify ''' stash name: 'tailwindcss-output', includes: 'static/output.css' } } - stage('Build') { + stage('Matrix Build') { matrix { axes { axis { @@ -40,7 +40,6 @@ pipeline { apiVersion: v1 kind: Pod metadata: - name: kaniko-sayauz-web namespace: jenkins spec: containers: -- cgit v1.3.1+13 From 9f40b572cd96e44aa08814628b06f446fcf559ce Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Mon, 22 Jun 2026 21:55:11 +0700 Subject: fix: specify resource constraints for kaniko container fix: explicitly set goos/goarch for dockerfile --- Dockerfile | 6 ++++-- Jenkinsfile | 14 +++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 37fe431..d0b6621 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,9 @@ FROM golang:1.26.4-alpine3.24 AS build-stage -ENV GOOS=linux -ENV GOARCH=amd64 +ARG TARGETOS=linux +ARG TARGETARCH=amd64 +ENV GOOS=${TARGETOS} +ENV GOARCH=${TARGETARCH} RUN apk add --no-cache sqlite-dev musl-dev gcc diff --git a/Jenkinsfile b/Jenkinsfile index 2eb561b..c9103e8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -48,6 +48,14 @@ spec: imagePullPolicy: Always command: [ /busybox/cat ] tty: true + resources: + requests: + cpu: "1" + memory: 2Gi + ephemeral-storage: 4Gi + limits: + memory: 4Gi + ephemeral-storage: 8Gi """ } } @@ -69,7 +77,11 @@ spec: if [ "$TAG_NAME" != "" ]; then pushToTags="$pushToTags $IMAGE_PUSH_DESTINATION:stable $IMAGE_PUSH_DESTINATION:$TAG_NAME" fi - /kaniko/executor --context `pwd` --custom-platform=${GOOS}/${GOARCH} --destination $pushToTags + /kaniko/executor --context `pwd` \ + --custom-platform=${GOOS}/${GOARCH} \ + --build-arg TARGETOS=${GOOS} + --build-arg TARGETARCH=${GOARCH} + --destination $pushToTags ''' } catch (Exception e) { echo "Caught exception: ${e.getMessage()}" -- cgit v1.3.1+13 From f112ccb8566f27dde315a829c4ca1ceb0237ca3e Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Mon, 22 Jun 2026 22:03:14 +0700 Subject: fix: specify correct type of registry-sayagit-jenkins-password cred --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c9103e8..995e09b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -66,7 +66,7 @@ spec: checkout scm unstash 'tailwindcss-output' container(name: 'kaniko', shell: '/busybox/sh') { - withCredentials([file(credentialsId: 'registry-sayagit-jenkins-password', variable: 'REGISTRY_SAYAGIT_JENKINS_PASSWORD')]) { + withCredentials([string(credentialsId: 'registry-sayagit-jenkins-password', variable: 'REGISTRY_SAYAGIT_JENKINS_PASSWORD')]) { withEnv(['PATH+EXTRA=/busybox']) { script { try { -- cgit v1.3.1+13 From 5e185accb5af0f1f34f92e5256619f6289dcf474 Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Mon, 22 Jun 2026 22:07:24 +0700 Subject: fix: specify git_commit_short out of agent --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 995e09b..a208247 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -69,11 +69,12 @@ spec: withCredentials([string(credentialsId: 'registry-sayagit-jenkins-password', variable: 'REGISTRY_SAYAGIT_JENKINS_PASSWORD')]) { withEnv(['PATH+EXTRA=/busybox']) { script { + env.GIT_COMMIT_SHORT = env.GIT_COMMIT ? env.GIT_COMMIT.take(7) : "unknown" try { sh '''#!/busybox/sh mkdir -p /kaniko/.docker echo "{\"auths\":{\"https://registry.sayag.it\":{\"username\":\"jenkins\",\"password\":\"$REGISTRY_SAYAGIT_JENKINS_PASSWORD\"}}}" > /kaniko/.docker/config.json - pushToTags="$IMAGE_PUSH_DESTINATION:latest $IMAGE_PUSH_DESTINATION:commit-`git rev-parse --short HEAD`" + pushToTags="$IMAGE_PUSH_DESTINATION:latest $IMAGE_PUSH_DESTINATION:commit-$GIT_COMMIT_SHORT if [ "$TAG_NAME" != "" ]; then pushToTags="$pushToTags $IMAGE_PUSH_DESTINATION:stable $IMAGE_PUSH_DESTINATION:$TAG_NAME" fi -- cgit v1.3.1+13 From 59ebca24c40390a2f7f087bab2dc83938fd0c933 Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Mon, 22 Jun 2026 22:09:29 +0700 Subject: fix: unterminated quote string --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a208247..ff90dad 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -74,7 +74,7 @@ spec: sh '''#!/busybox/sh mkdir -p /kaniko/.docker echo "{\"auths\":{\"https://registry.sayag.it\":{\"username\":\"jenkins\",\"password\":\"$REGISTRY_SAYAGIT_JENKINS_PASSWORD\"}}}" > /kaniko/.docker/config.json - pushToTags="$IMAGE_PUSH_DESTINATION:latest $IMAGE_PUSH_DESTINATION:commit-$GIT_COMMIT_SHORT + pushToTags="$IMAGE_PUSH_DESTINATION:latest $IMAGE_PUSH_DESTINATION:commit-$GIT_COMMIT_SHORT" if [ "$TAG_NAME" != "" ]; then pushToTags="$pushToTags $IMAGE_PUSH_DESTINATION:stable $IMAGE_PUSH_DESTINATION:$TAG_NAME" fi -- cgit v1.3.1+13 From 4e807e9df21b44b0080487f9ae43a2d0d4011ddd Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Mon, 22 Jun 2026 22:30:31 +0700 Subject: feat: stitch manifests of each architecture --- Jenkinsfile | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 63 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ff90dad..34b6f5d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -74,15 +74,11 @@ spec: sh '''#!/busybox/sh mkdir -p /kaniko/.docker echo "{\"auths\":{\"https://registry.sayag.it\":{\"username\":\"jenkins\",\"password\":\"$REGISTRY_SAYAGIT_JENKINS_PASSWORD\"}}}" > /kaniko/.docker/config.json - pushToTags="$IMAGE_PUSH_DESTINATION:latest $IMAGE_PUSH_DESTINATION:commit-$GIT_COMMIT_SHORT" - if [ "$TAG_NAME" != "" ]; then - pushToTags="$pushToTags $IMAGE_PUSH_DESTINATION:stable $IMAGE_PUSH_DESTINATION:$TAG_NAME" - fi /kaniko/executor --context `pwd` \ - --custom-platform=${GOOS}/${GOARCH} \ - --build-arg TARGETOS=${GOOS} - --build-arg TARGETARCH=${GOARCH} - --destination $pushToTags + --custom-platform=linux/${GOARCH} \ + --build-arg TARGETOS=linux \ + --build-arg TARGETARCH=${GOARCH} \ + --destination $IMAGE_PUSH_DESTINATION:commit-$GIT_COMMIT_SHORT-$GOARCH ''' } catch (Exception e) { echo "Caught exception: ${e.getMessage()}" @@ -98,5 +94,64 @@ spec: } } } + stage('Stitch Manifest') { + agent { + kubernetes { + defaultContainer 'manifest-tool' + yaml """ +apiVersion: v1 +kind: Pod +metadata: + namespace: jenkins +spec: + containers: + - name: manifest-tool + image: mplatform/manifest-tool:alpine-v2.2.2 + imagePullPolicy: Always + entrypoint: [ 'true' ] + tty: true + resources: + requests: + cpu: "1" + memory: 2Gi + ephemeral-storage: 4Gi +""" + } + } + environment { + IMAGE_PUSH_DESTINATION="registry.sayag.it/sayauz/web" + } + steps { + script { + env.GIT_COMMIT_SHORT = env.GIT_COMMIT ? env.GIT_COMMIT.take(7) : "unknown" + sh '''#!/busybox/sh + mkdir -p /kaniko/.docker + echo "{\"auths\":{\"https://registry.sayag.it\":{\"username\":\"jenkins\",\"password\":\"$REGISTRY_SAYAGIT_JENKINS_PASSWORD\"}}}" > /kaniko/.docker/config.json + pushToTags="$IMAGE_PUSH_DESTINATION:commit-$GIT_COMMIT_SHORT-$GOARCH" + if [ "$TAG_NAME" != "" ]; then + pushToTags="$pushToTags $IMAGE_PUSH_DESTINATION:$TAG_NAME-$GOARCH" + fi + manifest-tool push from-args \ + --platforms linux/amd64,linux/arm64 \ + --template $IMAGE_PUSH_DESTINATION:commit-$GIT_COMMIT_SHORT-ARCH \ + --target $IMAGE_PUSH_DESTINATION:commit-$GIT_COMMIT_SHORT + manifest-tool push from-args \ + --platforms linux/amd64,linux/arm64 \ + --template $IMAGE_PUSH_DESTINATION:commit-$GIT_COMMIT_SHORT-ARCH \ + --target $IMAGE_PUSH_DESTINATION:latest + if [ "$TAG_NAME" != "" ]; then + manifest-tool push from-args \ + --platforms linux/amd64,linux/arm64 \ + --template $IMAGE_PUSH_DESTINATION:commit-$GIT_COMMIT_SHORT-ARCH \ + --target $IMAGE_PUSH_DESTINATION:stable + manifest-tool push from-args \ + --platforms linux/amd64,linux/arm64 \ + --template $IMAGE_PUSH_DESTINATION:commit-$GIT_COMMIT_SHORT-ARCH \ + --target $IMAGE_PUSH_DESTINATION:$TAG_NAME + fi + ''' + } + } + } } } -- cgit v1.3.1+13 From 911bc8bc00b69496cbc9c77c869ea1c8e0abbec8 Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Mon, 22 Jun 2026 22:42:32 +0700 Subject: fix: registry name key in docker auth json --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 34b6f5d..5d45ac9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -73,7 +73,7 @@ spec: try { sh '''#!/busybox/sh mkdir -p /kaniko/.docker - echo "{\"auths\":{\"https://registry.sayag.it\":{\"username\":\"jenkins\",\"password\":\"$REGISTRY_SAYAGIT_JENKINS_PASSWORD\"}}}" > /kaniko/.docker/config.json + echo "{\"auths\":{\"registry.sayag.it\":{\"username\":\"jenkins\",\"password\":\"$REGISTRY_SAYAGIT_JENKINS_PASSWORD\"}}}" > /kaniko/.docker/config.json /kaniko/executor --context `pwd` \ --custom-platform=linux/${GOARCH} \ --build-arg TARGETOS=linux \ @@ -126,7 +126,7 @@ spec: env.GIT_COMMIT_SHORT = env.GIT_COMMIT ? env.GIT_COMMIT.take(7) : "unknown" sh '''#!/busybox/sh mkdir -p /kaniko/.docker - echo "{\"auths\":{\"https://registry.sayag.it\":{\"username\":\"jenkins\",\"password\":\"$REGISTRY_SAYAGIT_JENKINS_PASSWORD\"}}}" > /kaniko/.docker/config.json + echo "{\"auths\":{\"registry.sayag.it\":{\"username\":\"jenkins\",\"password\":\"$REGISTRY_SAYAGIT_JENKINS_PASSWORD\"}}}" > /kaniko/.docker/config.json pushToTags="$IMAGE_PUSH_DESTINATION:commit-$GIT_COMMIT_SHORT-$GOARCH" if [ "$TAG_NAME" != "" ]; then pushToTags="$pushToTags $IMAGE_PUSH_DESTINATION:$TAG_NAME-$GOARCH" -- cgit v1.3.1+13 From 58f4473eb900cd74c2603af07b03d602c4d5db01 Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Mon, 22 Jun 2026 22:46:00 +0700 Subject: fix: use printf for docker config put --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5d45ac9..bbf8f09 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -73,7 +73,7 @@ spec: try { sh '''#!/busybox/sh mkdir -p /kaniko/.docker - echo "{\"auths\":{\"registry.sayag.it\":{\"username\":\"jenkins\",\"password\":\"$REGISTRY_SAYAGIT_JENKINS_PASSWORD\"}}}" > /kaniko/.docker/config.json + printf '{"auths":{"registry.sayag.it":{"username":"jenkins","password":"%s"}}}' "$REGISTRY_SAYAGIT_JENKINS_PASSWORD" > /kaniko/.docker/config.json /kaniko/executor --context `pwd` \ --custom-platform=linux/${GOARCH} \ --build-arg TARGETOS=linux \ @@ -126,7 +126,7 @@ spec: env.GIT_COMMIT_SHORT = env.GIT_COMMIT ? env.GIT_COMMIT.take(7) : "unknown" sh '''#!/busybox/sh mkdir -p /kaniko/.docker - echo "{\"auths\":{\"registry.sayag.it\":{\"username\":\"jenkins\",\"password\":\"$REGISTRY_SAYAGIT_JENKINS_PASSWORD\"}}}" > /kaniko/.docker/config.json + printf '{"auths":{"registry.sayag.it":{"username":"jenkins","password":"%s"}}}' "$REGISTRY_SAYAGIT_JENKINS_PASSWORD" > /kaniko/.docker/config.json pushToTags="$IMAGE_PUSH_DESTINATION:commit-$GIT_COMMIT_SHORT-$GOARCH" if [ "$TAG_NAME" != "" ]; then pushToTags="$pushToTags $IMAGE_PUSH_DESTINATION:$TAG_NAME-$GOARCH" -- cgit v1.3.1+13 From 4b7f7666f28b2cf7f90ca940945df4cd256a3a87 Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Wed, 29 Jul 2026 17:10:14 +0700 Subject: fix: generate docker config correctly in stitch credentials job --- Jenkinsfile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bbf8f09..c386e7d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -42,6 +42,8 @@ kind: Pod metadata: namespace: jenkins spec: + nodeSelector: + kubernetes.io/arch: ${GOARCH} containers: - name: kaniko image: gcr.io/kaniko-project/executor:v1.24.0-debug @@ -124,13 +126,12 @@ spec: steps { script { env.GIT_COMMIT_SHORT = env.GIT_COMMIT ? env.GIT_COMMIT.take(7) : "unknown" + } + withCredentials([string(credentialsId: 'registry-sayagit-jenkins-password', variable: 'REGISTRY_SAYAGIT_JENKINS_PASSWORD')]) { sh '''#!/busybox/sh - mkdir -p /kaniko/.docker - printf '{"auths":{"registry.sayag.it":{"username":"jenkins","password":"%s"}}}' "$REGISTRY_SAYAGIT_JENKINS_PASSWORD" > /kaniko/.docker/config.json - pushToTags="$IMAGE_PUSH_DESTINATION:commit-$GIT_COMMIT_SHORT-$GOARCH" - if [ "$TAG_NAME" != "" ]; then - pushToTags="$pushToTags $IMAGE_PUSH_DESTINATION:$TAG_NAME-$GOARCH" - fi + mkdir -p /root/.docker + printf '{"auths":{"registry.sayag.it":{"username":"jenkins","password":"%s"}}}' "$REGISTRY_SAYAGIT_JENKINS_PASSWORD" > /root/.docker/config.json + manifest-tool push from-args \ --platforms linux/amd64,linux/arm64 \ --template $IMAGE_PUSH_DESTINATION:commit-$GIT_COMMIT_SHORT-ARCH \ -- cgit v1.3.1+13 From 7d8aedb482c8bfef96ad74b24a62edd71d729a67 Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Wed, 29 Jul 2026 18:34:40 +0700 Subject: fix: replace entrypoint with command for stitch manifest step --- Jenkinsfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c386e7d..050d041 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -110,7 +110,7 @@ spec: - name: manifest-tool image: mplatform/manifest-tool:alpine-v2.2.2 imagePullPolicy: Always - entrypoint: [ 'true' ] + command: [ 'cat' ] tty: true resources: requests: @@ -128,8 +128,7 @@ spec: env.GIT_COMMIT_SHORT = env.GIT_COMMIT ? env.GIT_COMMIT.take(7) : "unknown" } withCredentials([string(credentialsId: 'registry-sayagit-jenkins-password', variable: 'REGISTRY_SAYAGIT_JENKINS_PASSWORD')]) { - sh '''#!/busybox/sh - mkdir -p /root/.docker + sh '''mkdir -p /root/.docker printf '{"auths":{"registry.sayag.it":{"username":"jenkins","password":"%s"}}}' "$REGISTRY_SAYAGIT_JENKINS_PASSWORD" > /root/.docker/config.json manifest-tool push from-args \ -- cgit v1.3.1+13 From b587b7c0cbad02ec57cd64380d265eaa8777ad60 Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Thu, 30 Jul 2026 01:19:29 +0700 Subject: feat(ci): deploy stage --- Jenkinsfile | 156 ++++++++++++++++++++++++++++++++++++++++++++++++++++ deploy/playbook.yml | 4 +- 2 files changed, 158 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 050d041..e54d972 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -153,5 +153,161 @@ spec: } } } + stage('Deploy (Stage)') { + when { branch 'stage' } + agent { + kubernetes { + defaultContainer 'ansible' + yaml """ +apiVersion: v1 +kind: Pod +metadata: + namespace: jenkins +spec: + containers: + - name: ansible + image: ghcr.io/ansible/community-ansible-dev-tools:v26.7.2 + command: [ 'cat' ] + tty: true + resources: + requests: + cpu: "500m" + memory: 1Gi +""" + } + } + steps { + checkout scm + container('ansible') { + script { + env.GIT_COMMIT_SHORT = env.GIT_COMMIT ? env.GIT_COMMIT.take(7) : "unknown" + + def secretVars = [ + 'sayauz-web-stage-auth-salt' : 'AUTH_SALT', + 'sayauz-web-stage-s3-access-key-id' : 'S3_ACCESS_KEY_ID', + 'sayauz-web-stage-s3-secret-access-key' : 'S3_SECRET_ACCESS_KEY', + 'sayauz-web-stage-mail-salt' : 'MAIL_SALT', + 'sayauz-web-stage-mail-host' : 'MAIL_HOST', + 'sayauz-web-stage-mail-address' : 'MAIL_ADDRESS', + 'sayauz-web-stage-mail-username' : 'MAIL_USERNAME', + 'sayauz-web-stage-mail-password' : 'MAIL_PASSWORD' + ] + def bindings = secretVars.collect { id, varName -> string(credentialsId: id, variable: varName) } + bindings << sshUserPrivateKey(credentialsId: 'sayauz-svc-jenkins', keyFileVariable: 'SSH_KEY_FILE', usernameVariable: 'SSH_USER') + + withCredentials(bindings) { + sh ''' + ansible-galaxy collection install community.docker + + mkdir -p ~/.ssh + cp "$SSH_KEY_FILE" ~/.ssh/id_ed25519 + chmod 600 ~/.ssh/id_ed25519 + ssh-keyscan -H uz.saya.casa >> ~/.ssh/known_hosts + + ssh -o ConnectTimeout=10 -i ~/.ssh/id_ed25519 "$SSH_USER@uz.saya.casa" "echo 'SSH connection successful'" + + cd deploy + ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook \ + playbook.yml \ + -i inventory.yml \ + -l stage \ + --private-key ~/.ssh/id_ed25519 \ + -u "$SSH_USER" \ + -e saya_today_web_auth_salt="$AUTH_SALT" \ + -e saya_today_web_s3_access_key_id="$S3_ACCESS_KEY_ID" \ + -e saya_today_web_s3_secret_access_key="$S3_SECRET_ACCESS_KEY" \ + -e saya_today_web_environment=stage \ + -e saya_today_web_tag=commit-$GIT_COMMIT_SHORT \ + -e saya_today_web_mail_salt="$MAIL_SALT" \ + -e saya_today_web_mail_host="$MAIL_HOST" \ + -e saya_today_web_mail_address="$MAIL_ADDRESS" \ + -e saya_today_web_mail_username="$MAIL_USERNAME" \ + -e saya_today_web_mail_password="$MAIL_PASSWORD" + ''' + } + } + } + } + } + stage('Deploy (Prod)') { + when { buildingTag() } + agent { + kubernetes { + defaultContainer 'ansible' + yaml """ +apiVersion: v1 +kind: Pod +metadata: + namespace: jenkins +spec: + containers: + - name: ansible + image: ghcr.io/ansible/community-ansible-dev-tools:v26.7.2 + command: [ 'cat' ] + tty: true + resources: + requests: + cpu: "500m" + memory: 1Gi +""" + } + } + steps { + checkout scm + container('ansible') { + script { + def secretVars = [ + 'sayauz-web-prod-auth-salt' : 'AUTH_SALT', + 'sayauz-web-prod-s3-access-key-id' : 'S3_ACCESS_KEY_ID', + 'sayauz-web-prod-s3-secret-access-key' : 'S3_SECRET_ACCESS_KEY', + 'sayauz-web-prod-mail-salt' : 'MAIL_SALT', + 'sayauz-web-prod-mail-host' : 'MAIL_HOST', + 'sayauz-web-prod-mail-address' : 'MAIL_ADDRESS', + 'sayauz-web-prod-mail-username' : 'MAIL_USERNAME', + 'sayauz-web-prod-mail-password' : 'MAIL_PASSWORD', + 'sayauz-web-prod-verification-google' : 'GOOGLE_VERIFICATION', + 'sayauz-web-prod-verification-yandex' : 'YANDEX_VERIFICATION', + 'sayauz-web-prod-verification-bing' : 'BING_VERIFICATION' + ] + def bindings = secretVars.collect { id, varName -> string(credentialsId: id, variable: varName) } + bindings << sshUserPrivateKey(credentialsId: 'sayauz-svc-jenkins', keyFileVariable: 'SSH_KEY_FILE', usernameVariable: 'SSH_USER') + + withCredentials(bindings) { + sh ''' + ansible-galaxy collection install community.docker + + mkdir -p ~/.ssh + cp "$SSH_KEY_FILE" ~/.ssh/id_ed25519 + chmod 600 ~/.ssh/id_ed25519 + ssh-keyscan -H uz.saya.casa >> ~/.ssh/known_hosts + + ssh -o ConnectTimeout=10 -i ~/.ssh/id_ed25519 "$SSH_USER@uz.saya.casa" "echo 'SSH connection successful'" + + cd deploy + ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook \ + playbook.yml \ + -i inventory.yml \ + -l prod \ + --private-key ~/.ssh/id_ed25519 \ + -u "$SSH_USER" \ + -e saya_today_web_auth_salt="$AUTH_SALT" \ + -e saya_today_web_s3_access_key_id="$S3_ACCESS_KEY_ID" \ + -e saya_today_web_s3_secret_access_key="$S3_SECRET_ACCESS_KEY" \ + -e saya_today_web_environment=prod \ + -e saya_today_web_tag=$TAG_NAME \ + -e saya_today_web_mail_salt="$MAIL_SALT" \ + -e saya_today_web_mail_host="$MAIL_HOST" \ + -e saya_today_web_mail_address="$MAIL_ADDRESS" \ + -e saya_today_web_mail_username="$MAIL_USERNAME" \ + -e saya_today_web_mail_password="$MAIL_PASSWORD" \ + -e saya_today_google_verification="$GOOGLE_VERIFICATION" \ + -e saya_today_yandex_verification="$YANDEX_VERIFICATION" \ + -e saya_today_bing_verification="$BING_VERIFICATION" + ''' + } + } + } + } + } } } diff --git a/deploy/playbook.yml b/deploy/playbook.yml index f725335..c5c71fa 100644 --- a/deploy/playbook.yml +++ b/deploy/playbook.yml @@ -6,7 +6,7 @@ vars: docker_volumes: - "{{ saya_today_web_name }}-volume:/data:rw" - + tasks: - name: Initialize Unix socket volume when: >- @@ -42,7 +42,7 @@ MAIL_PASSWORD: "{{ saya_today_web_mail_password }}" MAIL_SALT: "{{ saya_today_web_mail_salt }}" FQDN: "{{ saya_today_web_listen_address }}" - GOOGLE_SITE_VERIFICATION: "{{ saya_today_google_site_verification | default('') }}" + GOOGLE_VERIFICATION: "{{ saya_today_google_verification | default('') }}" YANDEX_VERIFICATION: "{{ saya_today_yandex_verification | default('') }}" BING_VERIFICATION: "{{ saya_today_bing_verification | default('') }}" network_mode: caddy -- cgit v1.3.1+13 From 14cb8c5a6c3f703765beefa48b66620996895d10 Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Thu, 30 Jul 2026 01:39:16 +0700 Subject: fix: use correct credentials for deploy user --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e54d972..8633145 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -193,7 +193,7 @@ spec: 'sayauz-web-stage-mail-password' : 'MAIL_PASSWORD' ] def bindings = secretVars.collect { id, varName -> string(credentialsId: id, variable: varName) } - bindings << sshUserPrivateKey(credentialsId: 'sayauz-svc-jenkins', keyFileVariable: 'SSH_KEY_FILE', usernameVariable: 'SSH_USER') + bindings << sshUserPrivateKey(credentialsId: 'sayauz-svc-github', keyFileVariable: 'SSH_KEY_FILE', usernameVariable: 'SSH_USER') withCredentials(bindings) { sh ''' @@ -270,7 +270,7 @@ spec: 'sayauz-web-prod-verification-bing' : 'BING_VERIFICATION' ] def bindings = secretVars.collect { id, varName -> string(credentialsId: id, variable: varName) } - bindings << sshUserPrivateKey(credentialsId: 'sayauz-svc-jenkins', keyFileVariable: 'SSH_KEY_FILE', usernameVariable: 'SSH_USER') + bindings << sshUserPrivateKey(credentialsId: 'sayauz-svc-github', keyFileVariable: 'SSH_KEY_FILE', usernameVariable: 'SSH_USER') withCredentials(bindings) { sh ''' -- cgit v1.3.1+13 From 6ed1abb9ac5b6feb5a720785a633ef1f9acc7699 Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Thu, 30 Jul 2026 01:48:03 +0700 Subject: fix: use sayauz web image from registry.sayag.it --- deploy/playbook.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/playbook.yml b/deploy/playbook.yml index c5c71fa..057cc19 100644 --- a/deploy/playbook.yml +++ b/deploy/playbook.yml @@ -26,11 +26,11 @@ community.docker.docker_volume: name: "{{ saya_today_web_name }}-volume" - - name: Deploy saya-today-web Docker Container + - name: Deploy sayauz/web Docker Container community.docker.docker_container: name: "{{ saya_today_web_name }}" hostname: "{{ saya_today_web_hostname }}" - image: "ghcr.io/sayaandy/saya-today-web:{{ saya_today_web_tag }}" + image: "registry.sayag.it/sayauz/web:{{ saya_today_web_tag }}" env: S3_ACCESS_KEY_ID: "{{ saya_today_web_s3_access_key_id }}" S3_SECRET_ACCESS_KEY: "{{ saya_today_web_s3_secret_access_key }}" -- cgit v1.3.1+13 From 4bdcac0a88d0510df9cdef2e99bee20370fe219b Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Thu, 30 Jul 2026 10:57:59 +0700 Subject: rm: github workflow --- .github/workflows/build-and-deploy-prod.yml | 103 -------------------------- .github/workflows/build-and-deploy-stage.yml | 104 --------------------------- 2 files changed, 207 deletions(-) delete mode 100644 .github/workflows/build-and-deploy-prod.yml delete mode 100644 .github/workflows/build-and-deploy-stage.yml diff --git a/.github/workflows/build-and-deploy-prod.yml b/.github/workflows/build-and-deploy-prod.yml deleted file mode 100644 index fc44571..0000000 --- a/.github/workflows/build-and-deploy-prod.yml +++ /dev/null @@ -1,103 +0,0 @@ -name: Docker image building and publishing onto Production -on: - push: - tags: - - "*" -jobs: - build-and-push: - if: github.repository == 'SayaAndy/saya-today-web' - runs-on: ubuntu-latest - environment: Production - permissions: - packages: write - steps: - - name: Checkout - uses: actions/checkout@v6 - - - name: Generate output.css with tailwindcss - uses: ZoeyVid/tailwindcss-update@main - with: - input: static/input.css - output: static/output.css - params: "--minify" - - - name: Set up QEMU - uses: docker/setup-qemu-action@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v4 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v4 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GHCR_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v7 - with: - context: . - file: ./Dockerfile - push: true - cache-from: type=gha - cache-to: type=gha,mode=max - tags: | - ghcr.io/sayaandy/saya-today-web:latest - ghcr.io/sayaandy/saya-today-web:stable - ghcr.io/sayaandy/saya-today-web:${{ github.ref_name }} - - deploy: - if: github.repository == 'SayaAndy/saya-today-web' - runs-on: ubuntu-latest - environment: Production - needs: [build-and-push] - container: - image: ghcr.io/ansible/community-ansible-dev-tools:v26.4.6 - options: --user root - steps: - - name: Checkout - uses: actions/checkout@v6 - - - name: Install community.docker collection - run: ansible-galaxy collection install community.docker - - - name: Set up SSH connection for uz.saya.casa - run: | - mkdir -p ~/.ssh - (cat < ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 - sed -i 's/\r$//' ~/.ssh/id_ed25519 - ssh-keyscan -H uz.saya.casa >> ~/.ssh/known_hosts - - - name: Test SSH connection - run: | - ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ~/.ssh/id_ed25519 svc_github@uz.saya.casa "echo 'SSH connection successful'" - - - name: Run Ansible playbook - env: - ANSIBLE_HOST_KEY_CHECKING: "False" - working-directory: ./deploy - run: | - ansible-playbook \ - playbook.yml \ - -i inventory.yml \ - -l prod \ - --private-key ~/.ssh/id_ed25519 \ - -u svc_github \ - -e saya_today_web_auth_salt="${{ secrets.AUTH_SALT }}" \ - -e saya_today_web_s3_access_key_id="${{ secrets.S3_ACCESS_KEY_ID }}" \ - -e saya_today_web_s3_secret_access_key="${{ secrets.S3_SECRET_ACCESS_KEY }}" \ - -e saya_today_web_environment=prod \ - -e saya_today_web_tag=${{ github.ref_name }} \ - -e saya_today_web_mail_salt="${{ secrets.MAIL_SALT }}" \ - -e saya_today_web_mail_host="${{ secrets.MAIL_HOST }}" \ - -e saya_today_web_mail_address="${{ secrets.MAIL_ADDRESS }}" \ - -e saya_today_web_mail_username="${{ secrets.MAIL_USERNAME }}" \ - -e saya_today_web_mail_password="${{ secrets.MAIL_PASSWORD }}" \ - -e saya_today_google_site_verification="${{ secrets.GOOGLE_SITE_VERIFICATION }}" \ - -e saya_today_yandex_verification="${{ secrets.YANDEX_VERIFICATION }}" \ - -e saya_today_bing_verification="${{ secrets.BING_VERIFICATION }}" diff --git a/.github/workflows/build-and-deploy-stage.yml b/.github/workflows/build-and-deploy-stage.yml deleted file mode 100644 index ce4a1fb..0000000 --- a/.github/workflows/build-and-deploy-stage.yml +++ /dev/null @@ -1,104 +0,0 @@ -name: Docker image building and publishing onto Stage -on: - push: - branches: [stage] -jobs: - build-and-push: - if: github.repository == 'SayaAndy/saya-today-web' - runs-on: ubuntu-latest - environment: Stage - permissions: - packages: write - outputs: - sha_short: ${{ steps.ghss_vars.outputs.sha_short }} - steps: - - name: Checkout - uses: actions/checkout@v6 - - - name: Generate output.css with tailwindcss - uses: ZoeyVid/tailwindcss-update@main - with: - input: static/input.css - output: static/output.css - params: "--minify" - - - name: Set up QEMU - uses: docker/setup-qemu-action@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v4 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v4 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GHCR_TOKEN }} - - - name: Set github short sha - id: ghss_vars - run: echo "sha_short=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT - - - name: Build and push - uses: docker/build-push-action@v7 - with: - context: . - file: ./Dockerfile - push: true - cache-from: type=gha - cache-to: type=gha,mode=max - tags: | - ghcr.io/sayaandy/saya-today-web:latest - ghcr.io/sayaandy/saya-today-web:commit-${{ steps.ghss_vars.outputs.sha_short }} - - deploy: - if: github.repository == 'SayaAndy/saya-today-web' - runs-on: ubuntu-latest - environment: Stage - needs: [build-and-push] - container: - image: ghcr.io/ansible/community-ansible-dev-tools:v26.4.6 - options: --user root - steps: - - name: Checkout - uses: actions/checkout@v6 - - - name: Install community.docker collection - run: ansible-galaxy collection install community.docker - - - name: Set up SSH connection for uz.saya.casa - run: | - mkdir -p ~/.ssh - (cat < ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 - sed -i 's/\r$//' ~/.ssh/id_ed25519 - ssh-keyscan -H uz.saya.casa >> ~/.ssh/known_hosts - - - name: Test SSH connection - run: | - ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ~/.ssh/id_ed25519 svc_github@uz.saya.casa "echo 'SSH connection successful'" - - - name: Run Ansible playbook - env: - ANSIBLE_HOST_KEY_CHECKING: "False" - working-directory: ./deploy - run: | - ansible-playbook \ - playbook.yml \ - -i inventory.yml \ - -l stage \ - --private-key ~/.ssh/id_ed25519 \ - -u svc_github \ - -e saya_today_web_auth_salt="${{ secrets.AUTH_SALT }}" \ - -e saya_today_web_s3_access_key_id="${{ secrets.S3_ACCESS_KEY_ID }}" \ - -e saya_today_web_s3_secret_access_key="${{ secrets.S3_SECRET_ACCESS_KEY }}" \ - -e saya_today_web_environment=stage \ - -e saya_today_web_tag=commit-${{ needs.build-and-push.outputs.sha_short }} \ - -e saya_today_web_mail_salt="${{ secrets.MAIL_SALT }}" \ - -e saya_today_web_mail_host="${{ secrets.MAIL_HOST }}" \ - -e saya_today_web_mail_address="${{ secrets.MAIL_ADDRESS }}" \ - -e saya_today_web_mail_username="${{ secrets.MAIL_USERNAME }}" \ - -e saya_today_web_mail_password="${{ secrets.MAIL_PASSWORD }}" -- cgit v1.3.1+13