Skip to content
This repository was archived by the owner on Oct 19, 2023. It is now read-only.

Remove usage of service account keys #513

Merged
merged 5 commits into from
Jun 18, 2020
Merged
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
6 changes: 3 additions & 3 deletions builder/gen-dockerfile/tests/GenFilesCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,13 @@ public function dataProvider()
// Overrides baseImage
__DIR__ . '/test_data/simplest',
[
'--php71-image' => 'gcr.io/php-mvm-a/php71:latest',
'--php72-image' => 'gcr.io/php-mvm-a/php72:latest',
'--php71-image' => 'gcr.io/php-mvm-a-28051/php71:latest',
'--php72-image' => 'gcr.io/php-mvm-a-28051/php72:latest',
],
'',
'/app',
'added by the php runtime builder',
'gcr.io/php-mvm-a/php72:latest'
'gcr.io/php-mvm-a-28051/php72:latest'
],
[
// Has document_root set
Expand Down
6 changes: 2 additions & 4 deletions scripts/acceptance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ cp "${PHP_DOCKER_GOOGLE_CREDENTIALS}" \
./service_account.json

# For nightly build
if [ "${GOOGLE_PROJECT_ID}" = "php-mvm-a" ]; then
gcloud auth activate-service-account \
--key-file="${PHP_DOCKER_GOOGLE_CREDENTIALS}"
gcloud config set project php-mvm-a
if [ "${GOOGLE_PROJECT_ID}" = "php-mvm-a-28051" ]; then
gcloud config set project php-mvm-a-28051
fi

scripts/run_acceptance_tests.sh
4 changes: 0 additions & 4 deletions scripts/check_versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ if [ ! -f "${PHP_DOCKER_GOOGLE_CREDENTIALS}" ]; then
exit 1
fi

# Use the service account for gcloud operations.
gcloud auth activate-service-account \
--key-file "${PHP_DOCKER_GOOGLE_CREDENTIALS}"

SRC_TMP=$(mktemp -d)

# build the php test runner
Expand Down
4 changes: 0 additions & 4 deletions scripts/install_test_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ if [ ! -f "${PHP_DOCKER_GOOGLE_CREDENTIALS}" ]; then
exit 1
fi

# Use the service account for gcloud operations.
gcloud auth activate-service-account \
--key-file "${PHP_DOCKER_GOOGLE_CREDENTIALS}"


if [ "${CIRCLECI}" == "true" ]; then
# Need sudo on circleci:
Expand Down
4 changes: 2 additions & 2 deletions scripts/jenkins_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ set -ex
export TEST_BUILD_DIR="${WORKSPACE}"
export HOME="${JENKINS_HOME}"
export GCLOUD_DIR="${HOME}/gcloud"
export GOOGLE_PROJECT_ID=php-mvm-a
export E2E_PROJECT_ID=php-mvm-a
export GOOGLE_PROJECT_ID=php-mvm-a-28051
export E2E_PROJECT_ID=php-mvm-a-28051
export CLOUDSDK_CORE_DISABLE_PROMPTS=1
export PATH=${GCLOUD_DIR}/google-cloud-sdk/bin:${PATH}
export CLOUDSDK_ACTIVE_CONFIG_NAME=php-docker-e2e
Expand Down
8 changes: 0 additions & 8 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@ then
fi
export CANDIDATE_TAG=${TAG}

cp "${PHP_DOCKER_GOOGLE_CREDENTIALS}" \
./service_account.json

# For nightly build
if [ "${GOOGLE_PROJECT_ID}" = "php-mvm-a" ]; then
gcloud auth activate-service-account \
--key-file="${PHP_DOCKER_GOOGLE_CREDENTIALS}"
fi
gcloud config set project ${GOOGLE_PROJECT_ID}

scripts/build_images.sh
Expand Down
2 changes: 1 addition & 1 deletion scripts/ubuntu-packages.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
env_vars {
key: "GOOGLE_PROJECT_ID"
value: "php-mvm-a"
value: "php-mvm-a-28051"
}

env_vars {
Expand Down
4 changes: 2 additions & 2 deletions scripts/update-gcs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ if [ -z "${DEB_TMP_DIR}" ]; then
fi

if [ -z "${DEBIAN_GCS_PATH}" ]; then
DEBIAN_GCS_PATH='gs://php-mvm-a/packages'
DEBIAN_GCS_PATH='gs://php-mvm-a-28051/packages'
fi

if [ -z "${UBUNTU_GCS_PATH}" ]; then
UBUNTU_GCS_PATH='gs://php-mvm-a/ubuntu-packages'
UBUNTU_GCS_PATH='gs://php-mvm-a-28051/ubuntu-packages'
fi

if [ "${1}" == "debian" ]; then
Expand Down
12 changes: 0 additions & 12 deletions testapps/build_pipeline/tests/tests/EndToEndTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,13 @@ public static function setUpBeforeClass()
self::fail('Please set ' . self::RUNTIME_BUILDER_ROOT_ENV . ' env var.');
}

self::execWithError(
sprintf(
'gsutil cp %s /service_account.json',
$service_account_json
),
'Failed to download the service account json file: '
);
self::execWithError(
sprintf(
'gcloud config set project %s',
$project_id
),
'Failed to set project_id: '
);
self::execWithError(
'gcloud -q auth activate-service-account '
. '--key-file=/service_account.json',
'Failed to activate the service account: '
);
self::execWithError(
'gcloud config set app/use_runtime_builders true',
'Failed to configure gcloud to use runtime builders: '
Expand Down
13 changes: 0 additions & 13 deletions testapps/build_pipeline_std/tests/tests/EndToEndTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,13 @@ public static function setUpBeforeClass()
if ($runtime_builder_root === false) {
self::fail('Please set ' . self::RUNTIME_BUILDER_ROOT_ENV . ' env var.');
}

self::execWithError(
sprintf(
'gsutil cp %s /service_account.json',
$service_account_json
),
'Failed to download the service account json file: '
);
self::execWithError(
sprintf(
'gcloud config set project %s',
$project_id
),
'Failed to set project_id: '
);
self::execWithError(
'gcloud -q auth activate-service-account '
. '--key-file=/service_account.json',
'Failed to activate the service account: '
);
self::execWithError(
'gcloud config set app/use_runtime_builders true',
'Failed to configure gcloud to use runtime builders: '
Expand Down
12 changes: 0 additions & 12 deletions testapps/php72_e2e/tests/tests/EndToEndTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,13 @@ public static function setUpBeforeClass()
self::fail('Please set ' . self::SERVICE_ACCOUNT_ENV . ' env var.');
}

self::execWithError(
sprintf(
'gsutil cp %s /service_account.json',
$service_account_json
),
'Failed to download the service account json file: '
);
self::execWithError(
sprintf(
'gcloud config set project %s',
$project_id
),
'Failed to set project_id: '
);
self::execWithError(
'gcloud -q auth activate-service-account '
. '--key-file=/service_account.json',
'Failed to activate the service account: '
);
self::deploy($project_id, $e2e_test_version);
}

Expand Down