pipeline { agent none stages { stage('Compile Tailwind CSS') { agent { docker { image 'node:26.3.1-alpine3.24' args '-v /tmp:/tmp -v /.npm:/.npm' } } steps { checkout scm sh ''' npm install tailwindcss @tailwindcss/cli @tailwindcss/forms npx tailwindcss -i static/input.css -o static/output.css --minify ''' stash name: 'tailwindcss-output', includes: 'static/output.css' } } stage('Matrix Build') { matrix { axes { axis { name 'GOOS' values 'linux' } axis { name 'GOARCH' values 'arm64', 'amd64' } } stages { stage('Build') { agent { kubernetes { defaultContainer 'kaniko' yaml """ apiVersion: v1 kind: Pod metadata: namespace: jenkins spec: containers: - name: kaniko image: gcr.io/kaniko-project/executor:v1.24.0-debug imagePullPolicy: Always command: [ /busybox/cat ] tty: true resources: requests: cpu: "1" memory: 2Gi ephemeral-storage: 4Gi limits: memory: 4Gi ephemeral-storage: 8Gi """ } } environment { IMAGE_PUSH_DESTINATION="registry.sayag.it/sayauz/web" } steps { checkout scm unstash 'tailwindcss-output' container(name: 'kaniko', shell: '/busybox/sh') { 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_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 ''' } catch (Exception e) { echo "Caught exception: ${e.getMessage()}" currentBuild.result = 'FAILURE' throw e } } } } } } } } } } } }