From 9f21d2c90abbba657cece9eeb10ffbe24fde5524 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Thu, 30 Jul 2020 15:25:48 -0400 Subject: [PATCH] Add unified description format to all the scripts (#334) * Add unified description format to all the scripts * Update check_plugin.sh * Update plugin_tag.sh * Update setup_runners.sh * Update userdata.sh * Update check_plugin.sh * Update plugin_tag.sh * Update setup_runners.sh * Update setup_runners_service.sh * Update setup_runners_service_windows.ps1 * Update userdata.sh * Update plugins-info * Update version-info * Update plugin_tag.sh * Update setup_runners.sh --- .github/scripts/check_plugin.sh | 21 ++++++++ .github/scripts/plugin_tag.sh | 16 ++++++ .github/scripts/setup_runners.sh | 51 +++++++++++++++++++ .github/scripts/setup_runners_service.sh | 15 ++++++ .../scripts/setup_runners_service_windows.ps1 | 15 ++++++ .github/scripts/userdata.sh | 20 ++++++++ bin/plugins-info | 17 +++++++ bin/version-info | 17 +++++-- 8 files changed, 168 insertions(+), 4 deletions(-) diff --git a/.github/scripts/check_plugin.sh b/.github/scripts/check_plugin.sh index 3a6785c5e..f741c747c 100755 --- a/.github/scripts/check_plugin.sh +++ b/.github/scripts/check_plugin.sh @@ -1,5 +1,26 @@ #!/bin/bash +###### Information ############################################################################ +# Name: check_plugin.sh +# Maintainer: ODFE Infra Team +# Language: Shell +# +# About: This script is to check plugin artifacts availability for odfe distros +# It will prepare emails to odfe-release-process@amazon.com and a chime msg +# to inform user the status of the list of plugins +# +# RED: plugin artifact is NOT in S3 and corresponding repo has NO tag cut +# YELLOW: plugin artifact is NOT in S3 but corresponding repo has A tag cut +# GREEN: plugin artifact is in S3 +# +# Usage: ./check_plugin.sh $PLUGIN_TYPES [$ODFE_VERSION] +# $PLUGIN_TYPES: zip,deb,rpm,kibana,clidvr,perftop (optional) +# $ODFE_VERSION: x.y.z (optional) +# +# Starting Date: 2020-05-29 +# Modified Date: 2020-07-30 +############################################################################################### + # Please leave it commented as aws s3 will fail if no plugin presents #set -e diff --git a/.github/scripts/plugin_tag.sh b/.github/scripts/plugin_tag.sh index a3f8255e1..3274f920c 100755 --- a/.github/scripts/plugin_tag.sh +++ b/.github/scripts/plugin_tag.sh @@ -1,4 +1,20 @@ #!/bin/bash + +###### Information ############################################################################ +# Name: plugin-tag.sh +# Maintainer: ODFE Infra Team +# Language: Shell +# +# About: Retrieve the latest tag of a specific repo on Git based on user parameters +# +# Usage: ./plugin-tag.sh $GIT_REPONAME [$OD_VERSION] +# $GIT_REPONAME: / (required) +# $OD_VERSION: ODFE Version (optional) +# +# Starting Date: 2020-06-17 +# Modified Date: 2020-07-30 +############################################################################################### + set -e # This script allows users to manually assign parameters diff --git a/.github/scripts/setup_runners.sh b/.github/scripts/setup_runners.sh index 547b62ec7..f8e0ed5f8 100755 --- a/.github/scripts/setup_runners.sh +++ b/.github/scripts/setup_runners.sh @@ -1,4 +1,55 @@ #!/bin/bash + +###### Information ############################################################################ +# Name: setup_runners.sh +# Maintainer: ODFE Infra Team +# Language: Shell +# +# About: 1. Run instances on EC2 based on parameters defined and wait for completion +# 2. SSH to these instances and configure / bootstrap on $GIT_URL_REPO as runners +# 3. Unbootstrap the runners and terminate the instances for cleanups +# +# Usage: ./setup_runners.sh $ACTION $EC2_INSTANCE_NAMES $GITHUB_TOKEN +# $ACTION: run | terminate (required) +# $EC2_INSTANCE_NAMES: (required, sep ",") +# $GITHUB_TOKEN: GitHub PAT with repo scope and Admin Access to $GIT_URL_REPO +# +# Requirements: The env that runs this script must have its AWS IAM with these configurations +# +# * SSM Role +# AmazonEC2RoleforSSM +# AmazonSSMManagedInstanceCore +# +# * EC2 User with FullAccess Policy requires these policies to attach to SSM Role +# { +# "Version": "2012-10-17", +# "Statement": [ +# { +# "Sid": "VisualEditor0", +# "Effect": "Allow", +# "Action": [ +# "ssm:SendCommand", +# "iam:PassRole" +# ], +# "Resource": [ +# "arn:aws:ssm:*:*:document/*", +# "arn:aws:ec2:*:*:instance/*", +# "arn:aws:iam:::role/" +# ] +# }, +# { +# "Sid": "VisualEditor1", +# "Effect": "Allow", +# "Action": "ssm:DescribeInstanceInformation", +# "Resource": "*" +# } +# ] +# } +# +# Starting Date: 2020-07-27 +# Modified Date: 2020-07-30 +############################################################################################### + set -e ##################################### diff --git a/.github/scripts/setup_runners_service.sh b/.github/scripts/setup_runners_service.sh index bac77611d..9bf0ea920 100755 --- a/.github/scripts/setup_runners_service.sh +++ b/.github/scripts/setup_runners_service.sh @@ -1,5 +1,20 @@ #!/bin/bash +###### Information ############################################################################ +# Name: setup_runners_service.sh +# Maintainer: ODFE Infra Team +# Language: Shell +# +# About: Setup ES/KIBANA for integTests on *NIX based ODFE distros w/wo Security +# +# Usage: ./setup_runners_service.sh $SETUP_DISTRO $SETUP_ACTION +# $SETUP_DISTRO: tar | deb | rpm (required) +# $SETUP_ACTION: --es | --es-nosec | --kibana | --kibana-nosec (required) +# +# Starting Date: 2020-07-27 +# Modified Date: 2020-07-30 +############################################################################################### + # This script allows users to manually assign parameters if [ "$#" -ne 2 ] || [ "$1" = "--help" ] || [ "$1" = "-h" ] then diff --git a/.github/scripts/setup_runners_service_windows.ps1 b/.github/scripts/setup_runners_service_windows.ps1 index 814cda7e4..8779c66b0 100755 --- a/.github/scripts/setup_runners_service_windows.ps1 +++ b/.github/scripts/setup_runners_service_windows.ps1 @@ -1,6 +1,21 @@ #!/usr/bin/env pwsh +###### Information ############################################################################ +# Name: setup_runners_service_windows.ps1 +# Maintainer: ODFE Infra Team +# Language: PowerShell +# +# About: Setup ES/KIBANA for integTests on Windows based ODFE distros w/wo Security +# +# Usage: ./setup_runners_service_windows.ps1 $SETUP_ACTION +# $SETUP_ACTION: --es | --es-nosec | --kibana | --kibana-nosec (required) +# +# Starting Date: 2020-07-27 +# Modified Date: 2020-07-30 +############################################################################################### + # Keep the pwsh script running even with errors +# Put this line before the .\gradlew.bat run #$ErrorActionPreference = 'SilentlyContinue' # setup user parameters diff --git a/.github/scripts/userdata.sh b/.github/scripts/userdata.sh index 30effdc3f..4287fcd45 100755 --- a/.github/scripts/userdata.sh +++ b/.github/scripts/userdata.sh @@ -1,5 +1,25 @@ #!/bin/bash +###### Information ############################################################################ +# Name: userdata.sh +# Maintainer: ODFE Infra Team +# Language: Shell +# +# About: This script is related to testing-domains set-up. +# See https://github.com/opendistro-for-elasticsearch/opendistro-build/pull/283 +# +# In order to set-up domains, EC2 needs to have ES and Kibana running, +# hence this script will act as userdata input to install and configure +# the necessary services while installing the EC2 via AutoScaling Groups +# +# Usage: ./userdata.sh $distribution $security +# $distribution: TAR | DEB | RPM (required) +# $security: ENABLE | DISABLE (required) +# +# Starting Date: 2020-06-24 +# Modified Date: 2020-07-30 +############################################################################################### + set -e REPO_ROOT=`git rev-parse --show-toplevel` ES_VER=`$REPO_ROOT/bin/version-info --es` diff --git a/bin/plugins-info b/bin/plugins-info index ef449d875..a14417b10 100755 --- a/bin/plugins-info +++ b/bin/plugins-info @@ -1,4 +1,21 @@ #!/bin/bash + +###### Information ############################################################################ +# Name: plugins-info +# Maintainer: ODFE Infra Team +# Language: Shell +# +# About: Print the ES/KIBANA plugin names and git urls with correct dependency orders +# as defined in the 'plugins.json' file +# +# Usage: ./plugins-info $PLUGINS_TYPE [$RETURN_TYPE] +# $PLUGINS_TYPE: (required) +# $RETURN_TYPE: | --git (optional) +# +# Starting Date: 2020-06-24 +# Modified Date: 2020-07-30 +############################################################################################### + set -e ROOT=`dirname $(realpath $0)`; PLUGINS_LIST="$ROOT/plugins.json" diff --git a/bin/version-info b/bin/version-info index f20536475..3d0116047 100755 --- a/bin/version-info +++ b/bin/version-info @@ -14,11 +14,20 @@ # permissions and limitations under the License. # -# Description: -# Print the ES version for the current branch, as defined in -# the 'version.json' file. +###### Information ############################################################################ +# Name: version-info +# Maintainer: ODFE Infra Team +# Language: Python # -# The version can also be forced by setting the ELASTIC_VERSION environment variable. +# About: Print the ES/ODFE version for the current/previous branches +# as defined in the 'version.json' file +# +# Usage: [python] ./version-info $VERSION_TYPE +# $VERSION_TYPE: --od | --od-prev | --es | --es-prev (required) +# +# Starting Date: 2019-05-15 +# Modified Date: 2020-07-30 +############################################################################################### import sys import json