Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- spring:
- cloud:
- gcp:
- project-id: <my_project_id>
- sql:
- database-name: <my_database_name>
- instance-connection-name: <my_instance_connection_name>
- jpa:
- database-platform: org.hibernate.dialect.MySQL55Dialect
- hibernate:
- ddl-auto: create-drop
- datasource:
- continue-on-error: true
- driver-class-name: com.mysql.cj.jdbc.Driver
- username: <my_cloud_sql_username>
- password: <my_cloud_sql_password>
- pipeline {
- agent any
- tools{
- maven 'Maven 3.5.2'
- jdk 'jdk8'
- }
- environment {
- IMAGE = readMavenPom().getArtifactId()
- VERSION = readMavenPom().getVersion()
- DEV_DB_USER = "${env.DEV_DB_USER}"
- DEV_DB_PASSWORD = "${env.DEV_DB_PASSWORD}"
- }
- stages {
- stage('Build docker image') {
- steps {
- sh 'mvn -Dmaven.test.skip=true clean package'
- script{
- docker.build '$IMAGE:$VERSION'
- }
- }
- }
- stage('Run unit tests') {
- steps {
- withEnv(['GCLOUD_PATH=/var/jenkins_home/google-cloud-sdk/bin']) {
- withCredentials([file(credentialsId: 'key-sa', variable: 'GC_KEY')]) {
- sh("gcloud auth activate-service-account --key-file=${GC_KEY}")
- sh("gcloud container clusters get-credentials <cluster_name> --zone northamerica-northeast1-a --project <project_id>")
- sh 'mvn test'
- }
- }
- }
- }
- }
- }
- Caused by:
- com.google.api.client.googleapis.json.GoogleJsonResponseException: 403
- Forbidden
- {
- "code" : 403,
- "errors" : [ {
- "domain" : "global",
- "message" : "Insufficient Permission: Request had insufficient authentication scopes.",
- "reason" : "insufficientPermissions"
- } ],
- "message" : "Insufficient Permission: Request had insufficient authentication scopes."
- }
- ...
- withCredentials([file(credentialsId: 'key-sa', variable: 'GC_KEY')]) {
- sh("gcloud auth activate-service-account --key-file=${GC_KEY}")
- sh("gcloud container clusters get-credentials <cluster_name> --zone northamerica-northeast1-a --project <project_id>")
- sh 'mvn test'
- }
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement