Skip to content
This repository was archived by the owner on Jul 20, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .kokoro/populate-secrets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
# Copyright 2020 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -eo pipefail

user_uid="$(id -u)"
user_gid="$(id -g)"

# Populates requested secrets set in SECRET_MANAGER_KEYS from service account:
# kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com
SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager"
mkdir -p ${SECRET_LOCATION}
for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g")
do
docker run --entrypoint=gcloud \
--user "${user_uid}:${user_gid}" \
--volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \
gcr.io/google.com/cloudsdktool/cloud-sdk \
secrets versions access latest \
--credential-file-override=${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json \
--project cloud-devrel-kokoro-resources \
--secret $key > \
"$SECRET_LOCATION/$key"
done
5 changes: 5 additions & 0 deletions .kokoro/presubmit/node10/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,8 @@ env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/nodejs-secret-manager/.kokoro/test.sh"
}
env_vars: {
key: "SECRET_MANAGER_KEYS"
value: "not_a_real_secret_testing_permissions,npm_publish_token"
}

2 changes: 1 addition & 1 deletion .kokoro/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /

cd $(dirname $0)/..

NPM_TOKEN=$(cat $KOKORO_KEYSTORE_DIR/73713_google-cloud-secret-manager-npm-token)
NPM_TOKEN=$(cat $KOKORO_GFILE_DIR/secret_manager/npm_publish_token
echo "//wombat-dressing-room.appspot.com/:_authToken=${NPM_TOKEN}" > ~/.npmrc

npm install
Expand Down
10 changes: 3 additions & 7 deletions .kokoro/release/publish.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,9 @@ before_action {
}
}

before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "google-cloud-secret-manager-npm-token"
}
}
env_vars: {
key: "SECRET_MANAGER_KEYS"
value: "npm_publish_token"
}

# Download trampoline resources.
Expand Down
3 changes: 3 additions & 0 deletions .kokoro/samples-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export GCLOUD_PROJECT=long-door-651

cd $(dirname $0)/..

# Test the new logic for populating secrets from secret manager:
cat $KOKORO_GFILE_DIR/secret_manager/not_a_real_secret_testing_permissions

# Run a pre-test hook, if a pre-samples-test.sh is in the project
if [ -f .kokoro/pre-samples-test.sh ]; then
set +x
Expand Down
5 changes: 5 additions & 0 deletions .kokoro/system-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export NPM_CONFIG_PREFIX=/home/node/.npm-global
export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json
export GCLOUD_PROJECT=long-door-651

# Test the new logic for populating secrets from secret manager:
cat $KOKORO_GFILE_DIR/secret_manager/not_a_real_secret_testing_permissions

exit 0

cd $(dirname $0)/..

# Run a pre-test hook, if a pre-system-test.sh is in the project
Expand Down
1 change: 1 addition & 0 deletions .kokoro/trampoline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ function cleanup() {
}
trap cleanup EXIT

$(dirname $0)/populate-secrets.sh # Secret Manager secrets.
python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async function createAndAccessSecret() {
name: version.name,
});

const responsePayload = accessResponse.payload.data.toString();
const responsePayload = accessResponse.payload.data.toString('utf8');
console.info(`Payload: ${responsePayload}`);
}
createAndAccessSecret();
Expand Down
444 changes: 222 additions & 222 deletions protos/protos.js

Large diffs are not rendered by default.

15 changes: 4 additions & 11 deletions synth.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,16 @@
{
"git": {
"name": ".",
"remote": "https://github.com/googleapis/nodejs-secret-manager.git",
"sha": "783524d5925029f130a8787f02319d14a0a8dc59"
"remote": "git@github.com:googleapis/nodejs-secret-manager.git",
"sha": "92d466e383867d312bc26e1133f3e079426d9b37"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "358c09c45c681c6773b49aeb136f0a7ccbf7720c",
"internalRef": "311216074"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "be74d3e532faa47eb59f1a0eaebde0860d1d8ab4"
"sha": "e45a2f54dce1ac68497acf305145f9e5bb7e1e48",
"internalRef": "314725741"
}
}
],
Expand Down