forked from datacommonsorg/website
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added script to create custom data commons docker artifact repo in gc…
…p. Added terraform variables for adjusting CDC web service instance count. (datacommonsorg#4828) * Added script to create custom data commons docker artifact repo in gcp. * Updated CDC terraform README.md * Added terraform variables for adjusting CDC web service instance count.
- Loading branch information
Showing
4 changed files
with
118 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
62 changes: 62 additions & 0 deletions
62
deploy/terraform-custom-datacommons/create_artifact_repository.sh
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/bash | ||
# Copyright 2025 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. | ||
|
||
# One-time setup script for creating a GCR artifact repository | ||
|
||
# Takes two arguments: the GCP project ID and optionally the region. | ||
set -e | ||
|
||
# Define color codes | ||
RED='\033[0;31m' | ||
GREEN='\033[0;32m' | ||
YELLOW='\033[1;33m' | ||
NC='\033[0m' # No Color | ||
|
||
# Check if the GCP project ID is provided | ||
if [ -z "$1" ]; then | ||
echo -e "${RED}Error: GCP project ID is required.${NC}" | ||
echo -e "${YELLOW}Usage: $0 <gcp-project-id>${NC}" | ||
exit 1 | ||
fi | ||
|
||
# First argument is the GCP project | ||
PROJECT_ID=$1 | ||
|
||
# Check if region is provided, otherwise default to us-central1 | ||
if [ -z "$2" ]; then | ||
REGION="us-central1" | ||
else | ||
REGION="$2" | ||
fi | ||
|
||
# Validate region format | ||
if ! [[ $REGION =~ ^[a-z]+-[a-z0-9]+$ ]]; then | ||
echo -e "${RED}Error: Invalid region format.${NC}" | ||
echo -e "${YELLOW}Region should be in format like 'us-central1'${NC}" | ||
exit 1 | ||
fi | ||
|
||
|
||
# Enable the Artifact Registry API | ||
gcloud services enable artifactregistry.googleapis.com --project $PROJECT_ID | ||
|
||
# Create the artifact repository | ||
gcloud artifacts repositories create $PROJECT_ID-artifacts \ | ||
--repository-format=docker \ | ||
--location=$REGION \ | ||
--description="Artifact repository for $PROJECT_ID" | ||
|
||
|
||
echo -e "${GREEN}Artifact repository created successfully.${NC}" |
This file contains 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
This file contains 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