Advertisement
Guest User

Untitled

a guest
Mar 4th, 2019
523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. spring:
  2. cloud:
  3. gcp:
  4. project-id: <my_project_id>
  5. sql:
  6. database-name: <my_database_name>
  7. instance-connection-name: <my_instance_connection_name>
  8.  
  9. jpa:
  10. database-platform: org.hibernate.dialect.MySQL55Dialect
  11. hibernate:
  12. ddl-auto: create-drop
  13.  
  14. datasource:
  15. continue-on-error: true
  16. driver-class-name: com.mysql.cj.jdbc.Driver
  17. username: <my_cloud_sql_username>
  18. password: <my_cloud_sql_password>
  19.  
  20. pipeline {
  21. agent any
  22.  
  23. tools{
  24. maven 'Maven 3.5.2'
  25. jdk 'jdk8'
  26. }
  27. environment {
  28. IMAGE = readMavenPom().getArtifactId()
  29. VERSION = readMavenPom().getVersion()
  30. DEV_DB_USER = "${env.DEV_DB_USER}"
  31. DEV_DB_PASSWORD = "${env.DEV_DB_PASSWORD}"
  32. }
  33.  
  34. stages {
  35. stage('Build docker image') {
  36. steps {
  37. sh 'mvn -Dmaven.test.skip=true clean package'
  38. script{
  39. docker.build '$IMAGE:$VERSION'
  40. }
  41.  
  42. }
  43. }
  44. stage('Run unit tests') {
  45.  
  46. steps {
  47. withEnv(['GCLOUD_PATH=/var/jenkins_home/google-cloud-sdk/bin']) {
  48. withCredentials([file(credentialsId: 'key-sa', variable: 'GC_KEY')]) {
  49. sh("gcloud auth activate-service-account --key-file=${GC_KEY}")
  50. sh("gcloud container clusters get-credentials <cluster_name> --zone northamerica-northeast1-a --project <project_id>")
  51. sh 'mvn test'
  52. }
  53. }
  54. }
  55. }
  56. }
  57. }
  58.  
  59. Caused by:
  60. com.google.api.client.googleapis.json.GoogleJsonResponseException: 403
  61. Forbidden
  62. {
  63. "code" : 403,
  64. "errors" : [ {
  65. "domain" : "global",
  66. "message" : "Insufficient Permission: Request had insufficient authentication scopes.",
  67. "reason" : "insufficientPermissions"
  68. } ],
  69. "message" : "Insufficient Permission: Request had insufficient authentication scopes."
  70. }
  71.  
  72. ...
  73. withCredentials([file(credentialsId: 'key-sa', variable: 'GC_KEY')]) {
  74. sh("gcloud auth activate-service-account --key-file=${GC_KEY}")
  75. sh("gcloud container clusters get-credentials <cluster_name> --zone northamerica-northeast1-a --project <project_id>")
  76. sh 'mvn test'
  77. }
  78. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement