Update Jenkinsfile
All checks were successful
jenkins_organization/checksum_verification_and_signature_verification/pipeline/head This commit looks good

This commit is contained in:
first_admin 2024-09-01 21:47:58 +00:00
parent 72252644df
commit 885a6ef32f

32
Jenkinsfile vendored
View File

@ -2,7 +2,7 @@ pipeline {
agent { label 'agent1' }
stages {
stage('Install Dependencies') {
stage('Weryfikacja podpisów cyfrowych') {
steps {
script {
def dependencies = sh(script: "jq -r '.dependencies | keys[]' package.json", returnStdout: true).split('\n')
@ -24,13 +24,6 @@ pipeline {
sh "wget https://registry.npmjs.org/${dep}/-/\$(jq -r '.dependencies[\"${dep}\"]' package.json)/${dep}.tgz.asc"
sh "gpg --verify ${dep}.tgz.asc ${dep}-*.tgz"
}
sh """
FILENAME=\$(ls ${dep}-*.tgz)
SHA256_SUM=\$(sha256sum \$FILENAME | awk '{ print \$1 }')
echo \"\${SHA256_SUM} \$FILENAME\" > ${dep}.sha256
sha256sum -c ${dep}.sha256
"""
}
if (unsignedPackages.size() > 0) {
@ -42,6 +35,29 @@ pipeline {
}
}
stage('Weryfikacja sum kontrolnych') {
steps {
script {
def dependencies = sh(script: "jq -r '.dependencies | keys[]' package.json", returnStdout: true).split('\n')
for (dep in dependencies) {
sh """
FILENAME=\$(ls ${dep}-*.tgz)
SHA256_SUM=\$(sha256sum \$FILENAME | awk '{ print \$1 }')
echo \"\${SHA256_SUM} \$FILENAME\" > ${dep}.sha256
sha256sum -c ${dep}.sha256
"""
}
}
}
}
stage('Instalacja zależności') {
steps {
sh 'npm install'
}
}
stage('Test') {
steps {
sh 'npm test'