This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "google_service_account" "custom" { | |
| account_id = "${var.app_name}" | |
| display_name = "Custom Service Account" | |
| } | |
| resource "google_project_iam_member" "secret-accessor-custom" { | |
| role = "roles/secretmanager.secretAccessor" | |
| member = "serviceAccount:${google_service_account.custom.email}" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { SecretManagerServiceClient } from '@google-cloud/secret-manager'; | |
| const secretManagerServiceClient = new SecretManagerServiceClient(); | |
| let secretCredentials; | |
| const initSecretCredentials = async () => { | |
| if (process.env.NODE_ENV === 'production') { | |
| const [secret] = await secretManagerServiceClient.accessSecretVersion({ | |
| name: `projects/${process.env.GCP_PROJECT}/secrets/secret-credentials/versions/latest`, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| job('jenkins-backup') { | |
| logRotator(30, -1, 30, -1) | |
| label('master') | |
| steps { | |
| shell(""" | |
| #!/bin/bash | |
| cd \$JENKINS_HOME | |
| NOW_DATE=\$(date +%Y-%m-%d) |