1
0
Fork 0
mirror of https://github.com/external-secrets/external-secrets.git synced 2024-12-14 11:57:59 +00:00

Add SA json creds as env var

This commit is contained in:
Lucas Severo Alves 2021-06-11 14:14:02 +02:00
parent 0655e600d5
commit b8c9c3c7d4
3 changed files with 7 additions and 6 deletions

View file

@ -19,6 +19,7 @@ env:
# a step 'if env.GHCR_USERNAME' != ""', so we copy these to succinctly test whether
# credentials have been provided before trying to run steps that need them.
GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }}
GCP_SM_SA_JSON: ${{ secrets.GCP_SM_SA_JSON}}
jobs:
detect-noop:

View file

@ -74,7 +74,7 @@ var _ = Describe("[gcp] ", func() {
})
It("should sync secrets", func() {
By("creating a AWS SM Secret")
By("creating a GCP SM Secret")
secretKey1 := fmt.Sprintf("%s-%s", f.Namespace.Name, "one")
secretValue := "great-value-test"
targetSecret := "target-secret"

View file

@ -16,12 +16,12 @@ import (
"context"
"fmt"
gcpsm "github.com/external-secrets/external-secrets/pkg/provider/gcp/secretmanager"
secretmanager "cloud.google.com/go/secretmanager/apiv1"
"golang.org/x/oauth2/google"
"google.golang.org/api/option"
secretmanager "cloud.google.com/go/secretmanager/apiv1"
secretmanagerpb "google.golang.org/genproto/googleapis/cloud/secretmanager/v1"
gcpsm "github.com/external-secrets/external-secrets/pkg/provider/gcp/secretmanager"
)
// CreateAWSSecretsManagerSecret creates a sm secret with the given value.
@ -30,7 +30,7 @@ func CreateGCPSecretsManagerSecret(projectID, secretName, secretValue string, cr
config, err := google.JWTConfigFromJSON(credentials, gcpsm.CloudPlatformRole)
if err != nil {
return fmt.Errorf("Unable to procces JSON credentials: %w", err)
return fmt.Errorf("unable to procces JSON credentials: %w", err)
}
ts := config.TokenSource(ctx)
@ -67,7 +67,7 @@ func CreateGCPSecretsManagerSecret(projectID, secretName, secretValue string, cr
// Call the API.
_, err = client.AddSecretVersion(ctx, addSecretVersionReq)
if err != nil {
return fmt.Errorf("failed to add secret version: %v", err)
return fmt.Errorf("failed to add secret version: %w", err)
}
return err