diff --git a/Jenkinsfile b/Jenkinsfile index 7e6697f..5b295ad 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,7 +18,6 @@ pipeline { GITLAB_NAMESPACE=credentials('gitlab-namespace-id') DOCKERHUB_TOKEN=credentials('docker-hub-ci-pat') QUAYIO_API_TOKEN=credentials('quayio-repo-api-token') - GIT_SIGNING_KEY=credentials('484fbca6-9a4f-455e-b9e3-97ac98785f5f') EXT_GIT_BRANCH = 'main' EXT_USER = 'bakito' EXT_REPO = 'adguardhome-sync' @@ -43,17 +42,19 @@ pipeline { stages { stage("Set git config"){ steps{ - sh '''#!/bin/bash - echo ${GIT_SIGNING_KEY} > /config/.ssh/id_sign - chmod 600 /config/.ssh/id_sign - ssh-keygen -y -f /config/.ssh/id_sign > /config/.ssh/id_sign.pub - echo "Using $(ssh-keygen -lf /config/.ssh/id_sign) to sign commits" - git config --global gpg.format ssh - git config --global user.signingkey /config/.ssh/id_sign - git config --global commit.gpgsign true - git config --global user.name LinuxServer-CI - git config --global user.email ci@linuxserver.io - ''' + withCredentials([sshUserPrivateKey(credentialsId: '484fbca6-9a4f-455e-b9e3-97ac98785f5f', keyFileVariable: 'GIT_SIGNING_KEY')]) { + sh '''#!/bin/bash + echo ${GIT_SIGNING_KEY} > /config/.ssh/id_sign + chmod 600 /config/.ssh/id_sign + ssh-keygen -y -f /config/.ssh/id_sign > /config/.ssh/id_sign.pub + echo "Using $(ssh-keygen -lf /config/.ssh/id_sign) to sign commits" + git config --global gpg.format ssh + git config --global user.signingkey /config/.ssh/id_sign + git config --global commit.gpgsign true + git config --global user.name LinuxServer-CI + git config --global user.email ci@linuxserver.io + ''' + } } } // Setup all the basic environment variables needed for the build @@ -540,17 +541,19 @@ pipeline { } steps { echo "Running on node: ${NODE_NAME}" - sh '''#!/bin/bash - echo ${GIT_SIGNING_KEY} > /config/.ssh/id_sign - chmod 600 /config/.ssh/id_sign - ssh-keygen -y -f /config/.ssh/id_sign > /config/.ssh/id_sign.pub - echo "Using $(ssh-keygen -lf /config/.ssh/id_sign) to sign commits" - git config --global gpg.format ssh - git config --global user.signingkey /config/.ssh/id_sign - git config --global commit.gpgsign true - git config --global user.name LinuxServer-CI - git config --global user.email ci@linuxserver.io - ''' + withCredentials([sshUserPrivateKey(credentialsId: '484fbca6-9a4f-455e-b9e3-97ac98785f5f', keyFileVariable: 'GIT_SIGNING_KEY')]) { + sh '''#!/bin/bash + echo ${GIT_SIGNING_KEY} > /config/.ssh/id_sign + chmod 600 /config/.ssh/id_sign + ssh-keygen -y -f /config/.ssh/id_sign > /config/.ssh/id_sign.pub + echo "Using $(ssh-keygen -lf /config/.ssh/id_sign) to sign commits" + git config --global gpg.format ssh + git config --global user.signingkey /config/.ssh/id_sign + git config --global commit.gpgsign true + git config --global user.name LinuxServer-CI + git config --global user.email ci@linuxserver.io + ''' + } sh "sed -r -i 's|(^FROM .*)|\\1\\n\\nENV LSIO_FIRST_PARTY=true|g' Dockerfile" sh "docker buildx build \ --label \"org.opencontainers.image.created=${GITHUB_DATE}\" \ @@ -583,17 +586,19 @@ pipeline { stage('Build X86') { steps { echo "Running on node: ${NODE_NAME}" - sh '''#!/bin/bash - echo ${GIT_SIGNING_KEY} > /config/.ssh/id_sign - chmod 600 /config/.ssh/id_sign - ssh-keygen -y -f /config/.ssh/id_sign > /config/.ssh/id_sign.pub - echo "Using $(ssh-keygen -lf /config/.ssh/id_sign) to sign commits" - git config --global gpg.format ssh - git config --global user.signingkey /config/.ssh/id_sign - git config --global commit.gpgsign true - git config --global user.name LinuxServer-CI - git config --global user.email ci@linuxserver.io - ''' + withCredentials([sshUserPrivateKey(credentialsId: '484fbca6-9a4f-455e-b9e3-97ac98785f5f', keyFileVariable: 'GIT_SIGNING_KEY')]) { + sh '''#!/bin/bash + echo ${GIT_SIGNING_KEY} > /config/.ssh/id_sign + chmod 600 /config/.ssh/id_sign + ssh-keygen -y -f /config/.ssh/id_sign > /config/.ssh/id_sign.pub + echo "Using $(ssh-keygen -lf /config/.ssh/id_sign) to sign commits" + git config --global gpg.format ssh + git config --global user.signingkey /config/.ssh/id_sign + git config --global commit.gpgsign true + git config --global user.name LinuxServer-CI + git config --global user.email ci@linuxserver.io + ''' + } sh "sed -r -i 's|(^FROM .*)|\\1\\n\\nENV LSIO_FIRST_PARTY=true|g' Dockerfile" sh "docker buildx build \ --label \"org.opencontainers.image.created=${GITHUB_DATE}\" \ @@ -619,17 +624,19 @@ pipeline { } steps { echo "Running on node: ${NODE_NAME}" - sh '''#!/bin/bash - echo ${GIT_SIGNING_KEY} > /config/.ssh/id_sign - chmod 600 /config/.ssh/id_sign - ssh-keygen -y -f /config/.ssh/id_sign > /config/.ssh/id_sign.pub - echo "Using $(ssh-keygen -lf /config/.ssh/id_sign) to sign commits" - git config --global gpg.format ssh - git config --global user.signingkey /config/.ssh/id_sign - git config --global commit.gpgsign true - git config --global user.name LinuxServer-CI - git config --global user.email ci@linuxserver.io - ''' + withCredentials([sshUserPrivateKey(credentialsId: '484fbca6-9a4f-455e-b9e3-97ac98785f5f', keyFileVariable: 'GIT_SIGNING_KEY')]) { + sh '''#!/bin/bash + echo ${GIT_SIGNING_KEY} > /config/.ssh/id_sign + chmod 600 /config/.ssh/id_sign + ssh-keygen -y -f /config/.ssh/id_sign > /config/.ssh/id_sign.pub + echo "Using $(ssh-keygen -lf /config/.ssh/id_sign) to sign commits" + git config --global gpg.format ssh + git config --global user.signingkey /config/.ssh/id_sign + git config --global commit.gpgsign true + git config --global user.name LinuxServer-CI + git config --global user.email ci@linuxserver.io + ''' + } echo 'Logging into Github' sh '''#! /bin/bash echo $GITHUB_TOKEN | docker login ghcr.io -u LinuxServer-CI --password-stdin