pipeline { agent { kubernetes { yaml ''' apiVersion: v1 kind: Pod spec: containers: - name: alpine image: alpine:3.15 command: - sleep - infinity ''' } } stages { stage('Dependency check') { environment { DEPCHECKDB = credentials('depcheck-postgres') } steps { sh 'apk update && apk add openjdk11 java-postgresql-jdbc go' dependencyCheck additionalArguments: '-f JSON -f HTML -n --enableExperimental\ --dbDriverName org.postgresql.Driver \ --dbDriverPath /usr/share/java/postgresql-jdbc.jar \ --dbUser $DEPCHECKDB_USR \ --dbPassword $DEPCHECKDB_PSW \ --connectionString jdbc:postgresql://postgres-postgresql.postgres/depcheck', odcInstallation: 'depcheck' } } stage('SonarQube analysis') { environment { SONARSCANNER_HOME = tool 'sonarscanner' } steps { withSonarQubeEnv('sonarqube') { sh '$SONARSCANNER_HOME/bin/sonar-scanner' } } } stage('SonarQube quality gate') { steps { waitForQualityGate webhookSecretId: 'sonar-webhook', abortPipeline: true } } } }