Skip to content

fix: add buffer max size and chunk size #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 44 commits into from
Jan 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
d19540b
add buffer max size and chunk size
arthur-observe Dec 21, 2022
f2f9c93
fix sed
arthur-observe Dec 21, 2022
fc69795
allow retry to wait 5 minutes
arthur-observe Dec 21, 2022
2c461b0
run 4 times a day
arthur-observe Dec 21, 2022
3d13f2b
update branch used for pull request
arthur-observe Dec 21, 2022
ea4b5bf
update log config
arthur-observe Dec 21, 2022
15cc4f2
log format
arthur-observe Dec 21, 2022
cde339d
Merge branch 'main' into arthur/ob-14272
arthur-observe Dec 21, 2022
c6117da
log format
arthur-observe Dec 21, 2022
9099f3e
pass context to python
arthur-observe Dec 21, 2022
8d6eaf4
context by prop
arthur-observe Dec 21, 2022
f399b2a
add
arthur-observe Dec 21, 2022
a8cce59
try out dump
arthur-observe Dec 23, 2022
8faeec6
context dump
arthur-observe Dec 23, 2022
92910e6
context
arthur-observe Dec 23, 2022
d65d4fe
name step
arthur-observe Dec 23, 2022
e8f1911
remove python script
arthur-observe Dec 23, 2022
dfd0d23
test
arthur-observe Dec 23, 2022
f583b2c
workflow helper
arthur-observe Dec 23, 2022
af4120b
dir
arthur-observe Dec 23, 2022
9e5d6d7
move logic to python
arthur-observe Dec 24, 2022
57a98c3
missing quote
arthur-observe Dec 24, 2022
55db17e
quotes
arthur-observe Dec 24, 2022
da6260d
quotes
arthur-observe Dec 24, 2022
6fd4ba0
quotes
arthur-observe Dec 24, 2022
a64498e
script
arthur-observe Dec 24, 2022
7d8f2df
key
arthur-observe Dec 24, 2022
cd5a355
typo
arthur-observe Dec 24, 2022
3225892
bug fix
arthur-observe Dec 24, 2022
872c64e
path
arthur-observe Dec 24, 2022
49f31b8
clean up
arthur-observe Dec 24, 2022
71376a9
cleanup
arthur-observe Dec 24, 2022
d19a936
debug
arthur-observe Dec 24, 2022
b37d8eb
trouble
arthur-observe Dec 24, 2022
0284c52
trouble
arthur-observe Dec 24, 2022
bd37ac7
returns
arthur-observe Dec 24, 2022
45ce22f
test results
arthur-observe Dec 24, 2022
b213467
update workflows to reusable
arthur-observe Dec 24, 2022
10971c3
run on pull request
arthur-observe Dec 24, 2022
d19e488
pull request
arthur-observe Dec 24, 2022
1f69729
cleanup
arthur-observe Dec 25, 2022
d10349d
add comment for code
arthur-observe Jan 3, 2023
54a976f
comments and add back aws network
arthur-observe Jan 3, 2023
79f0ec8
fix head ref issue
arthur-observe Jan 3, 2023
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
164 changes: 56 additions & 108 deletions .github/workflows/AWS-EC2-Tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ on:
options:
- false
- true
push:
branches:
- 'test/**'
# push:
# branches:
# - 'test/**'
pull_request:

schedule:
Expand All @@ -51,12 +51,11 @@ jobs:
pull-requests: write
issues: read
checks: write
env: # Or as an environment variable
TF_VAR_OBSERVE_CUSTOMER_ID: ${{ secrets.TF_VAR_OBSERVE_CUSTOMER_ID }}
TF_VAR_OBSERVE_DATASTREAM_TOKEN: ${{ secrets.TF_VAR_OBSERVE_DATASTREAM_TOKEN }}
env:
TF_VAR_PUBLIC_KEY: ${{ secrets.TF_VAR_PUBLIC_KEY }}
TF_VAR_REGION: "us-west-2"
TF_VAR_USE_BRANCH_NAME: main

ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
Expand All @@ -68,86 +67,54 @@ jobs:
FAIL_FIRST_TEST: false
FAIL_SECOND_TEST: false
WORK_DIR: test_code


CLOUD: aws
MODULE: aws_machines
# TF_LOG: DEBUG

steps:
- name: Value of inputs
run: |
echo "install_script_branch=${{ github.event.inputs.install_script_branch }}"
echo "this_repo_branch=${{ github.event.inputs.this_repo_branch }}"
echo "terraform_run_destroy=${{ github.event.inputs.terraform_run_destroy }}"
echo "fail_first_test=${{ github.event.inputs.fail_first_test }}"
echo "fail_second_test=${{ github.event.inputs.fail_second_test }}"
# AWS Login - orig role - has to occur before checkout
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.THUNDERDOME_AWS_ROLE }}
aws-region: ${{ env.TF_VAR_REGION }}

- name: Set variables based on inputs
if: github.event.inputs.terraform_run_destroy != ''
- name: Set code repo
run: |

echo "TF_VAR_USE_BRANCH_NAME=${{ github.event.inputs.install_script_branch }}" >> $GITHUB_ENV

echo "THIS_REPO_BRANCH=refs/heads/${{ github.event.inputs.this_repo_branch }}" >> $GITHUB_ENV

echo "TERRAFORM_RUN_DESTROY=${{ github.event.inputs.terraform_run_destroy }}" >> $GITHUB_ENV

echo "FAIL_FIRST_TEST=${{ github.event.inputs.fail_first_test }}" >> $GITHUB_ENV
if ${{ github.event.inputs.this_repo_branch != '' }}; then
echo "THIS_REPO_BRANCH=refs/heads/${{ github.event.inputs.this_repo_branch }}" >> $GITHUB_ENV
else
echo "THIS_REPO_BRANCH=refs/heads/${{ github.head_ref }}" >> $GITHUB_ENV
fi

echo "FAIL_SECOND_TEST=${{ github.event.inputs.fail_second_test }}" >> $GITHUB_ENV
- name: Check out repository code
uses: actions/checkout@v3
with:
ref: ${{ env.THIS_REPO_BRANCH }}

- name: Set Custom Environment Variables
- name: Set contexts
run: |
# if pull request don't destroy resources
if ${{ github.event_name == 'pull_request' }}; then
echo "TERRAFORM_RUN_DESTROY=false" >> $GITHUB_ENV
echo "THIS_REPO_BRANCH=${{ github.ref }}" >> $GITHUB_ENV
fi

# value for resource names
echo "TF_VAR_WORKFLOW_MATRIX_VALUE=${{ matrix.test_groups }}" >> $GITHUB_ENV

# This variable tells code it running on CI server
echo "TF_VAR_CI=$CI" >> $GITHUB_ENV

# This variable gets just the branch name without url stuff
echo "GIT_HUB_SHORT_BRANCH_NAME=${GITHUB_BRANCH##*/}" >> $GITHUB_ENV

# Create directory for keys and set permissions
mkdir "$HOME/.ssh"
chmod 700 "$HOME/.ssh"
# variable for private key which is required for CI server to login to machines
echo "TF_VAR_PRIVATE_KEY_PATH=$HOME/.ssh/github_actions" >> $GITHUB_ENV
env:
GITHUB_BRANCH: ${{ github.ref }}
mkdir context
echo '${{ toJSON(github) }}' > context/github_context.json
echo '${{ toJSON(matrix) }}' > context/matrix_context.json
echo '${{ secrets.PRIVATE_KEY }}' > context/private_key

working-directory: "${{ env.WORK_DIR }}/python_scripts"

- name: Set SSH Key
- name: workflow helper
run: |
# variable for path to private key
echo "${{ secrets.PRIVATE_KEY }}" > "$TF_VAR_PRIVATE_KEY_PATH"
# set permissions for key file
chmod 600 "$TF_VAR_PRIVATE_KEY_PATH"
# display for troubleshooting
cat "$TF_VAR_PRIVATE_KEY_PATH"
python3 -c "from workflow_tasks import set_custom_vars; set_custom_vars(context_dir='context')"

- name: Print Environment Variables - troubleshooting
run: |
env | sort -f
python3 -c "from workflow_tasks import tf_override_file; tf_override_file(cloud=\"${{ env.CLOUD }}\", test_group=\"${{ matrix.test_groups }}\")"

- name: Check out repository code
uses: actions/checkout@v3
with:
ref: ${{ env.THIS_REPO_BRANCH }}
# !!! vvvvv THIS OVERWRITES MAIN.TF FILE for specific cloud module vvvvv !!!
python3 -c "from workflow_tasks import tf_main_file; tf_main_file(module=\"${{ env.MODULE }}\")"

- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false
python3 -c "from workflow_tasks import tf_output_file; tf_output_file(module=\"${{ env.MODULE }}\")"

# AWS Login - orig role
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.THUNDERDOME_AWS_ROLE }}
aws-region: ${{ env.TF_VAR_REGION }}
python3 -c "from workflow_tasks import config_ini; config_ini(custid=\"${{ secrets.STAGE_CUSTOMER_ID }}\", domain=\"${{ secrets.STAGE_DOMAIN }}\", token=\"${{ secrets.STAGE_DATASTREAM_TOKEN }}\")"

working-directory: "${{ env.WORK_DIR }}/python_scripts"

# GCP Login
# This is key generated in GCP console for service account
Expand All @@ -161,33 +128,21 @@ jobs:
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}

- name: 'Test gcloud CLI'
run: 'gcloud info'

- name: terraform and config files
- name: Print Environment Variables - troubleshooting
run: |
python3 -c "from workflow_tasks import tf_override_file; tf_override_file(cloud=\"aws\", test_group=\"${{ matrix.test_groups }}\")"

python3 -c "from workflow_tasks import tf_main_file; tf_main_file(module=\"aws_machines\")"

python3 -c "from workflow_tasks import tf_output_file; tf_output_file(module=\"aws_machines\")"

python3 -c "from workflow_tasks import config_ini; config_ini(custid=\"${{ secrets.STAGE_CUSTOMER_ID }}\", domain=\"${{ secrets.STAGE_DOMAIN }}\", token=\"${{ secrets.STAGE_DATASTREAM_TOKEN }}\")"
env | sort -f

working-directory: "${{ env.WORK_DIR }}/python_scripts"
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false

- name: terraform version
- name: terraform tasks
run: |
terraform version
working-directory: "${{ env.WORK_DIR }}"

- name: terraform init
run: |
terraform init
working-directory: "${{ env.WORK_DIR }}"

- name: terraform validate
run: |
terraform validate
working-directory: "${{ env.WORK_DIR }}"

Expand All @@ -197,7 +152,7 @@ jobs:
working-directory: "${{ env.WORK_DIR }}"

# Run tests
- name: python script
- name: run fabric tests python script
run: |
# create output directory for archive files
mkdir file_outputs
Expand All @@ -207,34 +162,27 @@ jobs:
pip3 install -r requirements.txt

# run tests
fab test -a ${{ env.FAIL_FIRST_TEST }} -b ${{ env.THIS_REPO_BRANCH }}
fab test -a ${{ env.FAIL_FIRST_TEST }} -b ${{ env.THIS_REPO_BRANCH }} -o "1: run fabric tests python script"
working-directory: "${{ env.WORK_DIR }}/python_scripts"

- name: Retry tests
if: ${{ env.TEST_RESULT == 'FAIL' }}
run: |
# run tests
fab test -a ${{ env.FAIL_SECOND_TEST }} -o 2 -b ${{ env.THIS_REPO_BRANCH }}
fab test -a ${{ env.FAIL_SECOND_TEST }} -o "2: Retry tests" -b ${{ env.THIS_REPO_BRANCH }}

working-directory: "${{ env.WORK_DIR }}/python_scripts"

- name: delete ini
- name: cleanup
if: always()
run: |
rm config.ini
working-directory: "${{ env.WORK_DIR }}/python_scripts"
rm -f python_scripts/config.ini

- name: clean_output
if: always()
run: |
sed -i 's/${{ secrets.STAGE_DATASTREAM_TOKEN }}/******/g' ./*
working-directory: "${{ env.WORK_DIR }}/python_scripts/file_outputs"
sed -i 's/${{ secrets.STAGE_DATASTREAM_TOKEN }}/******/g' ./python_scripts/file_outputs/*

- name: clean_logs
if: always()
run: |
sed -i 's/${{ secrets.STAGE_DATASTREAM_TOKEN }}/******/g' ./*
working-directory: "${{ env.WORK_DIR }}/python_scripts/log_outputs"
sed -i 's/${{ secrets.STAGE_DATASTREAM_TOKEN }}/******/g' ./python_scripts/log_outputs/*

working-directory: "${{ env.WORK_DIR }}"

- name: Archive test results
uses: actions/upload-artifact@v3
Expand Down
Loading