-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow to deploy environment with CDR infrastructure (#2457)
- Loading branch information
1 parent
7e2ff45
commit c441c7c
Showing
14 changed files
with
258 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
# Default values | ||
user="ubuntu" | ||
|
||
# Parse options | ||
while getopts ":k:s:u:h:d:c:" opt; do | ||
case $opt in | ||
k) | ||
key="$OPTARG" | ||
;; | ||
s) | ||
src_file="$OPTARG" | ||
;; | ||
u) | ||
user="$OPTARG" | ||
;; | ||
h) | ||
host="$OPTARG" | ||
;; | ||
d) | ||
dest_file="$OPTARG" | ||
;; | ||
c) | ||
command="$OPTARG" | ||
;; | ||
\?) | ||
echo "Invalid option -$OPTARG" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
# Ensure all mandatory parameters are provided | ||
if [ -z "$key" ] || [ -z "$src_file" ] || [ -z "$host" ] || [ -z "$dest_file" ] || [ -z "$command" ]; then | ||
echo "Usage: $0 -k <key> -s <source_file> -h <host> -d <destination_file> -c <command> [-u <user>]" | ||
exit 1 | ||
fi | ||
|
||
# Set the permission for the key file | ||
chmod 600 "$key" | ||
|
||
# Copy the file to the EC2/VM instance | ||
scp -o StrictHostKeyChecking=no -v -i "$key" "$src_file" "$user@$host:$dest_file" | ||
|
||
# Run the command on the remote EC2/VM instance | ||
ssh -o StrictHostKeyChecking=no -v -i "$key" "$user@$host" "$command" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Create Environment with Cloud Logs (CDR) | ||
run-name: Creating ${{ github.event.inputs.deployment_name }} by @${{ github.actor }} | ||
|
||
on: | ||
# Ability to execute on demand | ||
workflow_dispatch: | ||
inputs: | ||
deployment-name: | ||
type: string | ||
description: | | ||
Name with letters, numbers, hyphens; start with a letter. Max 20 chars. e.g., 'my-env-123' | ||
required: true | ||
serverless_mode: | ||
description: "Deploy a serverless project instead of an ESS deployment" | ||
type: boolean | ||
required: true | ||
default: false | ||
elk-stack-version: | ||
required: true | ||
description: "The version of the ELK stack: For BC use version without hash 8.x.y, for SNAPSHOT use 8.x.y-SNAPSHOT" | ||
default: "8.16.0" | ||
type: string | ||
docker-image-override: | ||
required: false | ||
description: "Provide the full Docker image path to override the default image (e.g. for testing BC/SNAPSHOT)" | ||
type: string | ||
|
||
jobs: | ||
deploy: | ||
uses: ./.github/workflows/test-environment.yml | ||
secrets: inherit | ||
# Required for the 'Deploy' job in the 'test-environment.yml' to authenticate with Google Cloud (gcloud). | ||
permissions: | ||
contents: 'read' | ||
id-token: 'write' | ||
with: | ||
deployment_name: ${{ inputs.deployment-name }} | ||
ess-region: 'gcp-us-west2' | ||
elk-stack-version: ${{ inputs.elk-stack-version }} | ||
serverless_mode: ${{ fromJSON(inputs.serverless_mode) }} | ||
cdr-infra: true |
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
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
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
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
Oops, something went wrong.