Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
2a00fe7
update actions
shayrm Oct 11, 2023
98c297b
update actions
shayrm Oct 11, 2023
95cd908
update actions
shayrm Oct 11, 2023
2432acd
update actions
shayrm Oct 11, 2023
c87cbc1
update actions
shayrm Oct 11, 2023
bb38903
update actions
shayrm Oct 11, 2023
c7d11a2
update actions
shayrm Oct 11, 2023
71f357b
update actions
shayrm Oct 11, 2023
965dcd2
update actions
shayrm Oct 11, 2023
ca57e0b
update actions with token
shayrm Oct 12, 2023
8a898f7
update actions with token
shayrm Oct 12, 2023
6711679
update actions with token
shayrm Oct 12, 2023
f98cc9a
update actions and jobs
shayrm Oct 12, 2023
b0f0d3b
adding curl to launch BP
shayrm Oct 12, 2023
e67376a
adding curl to launch BP
shayrm Oct 12, 2023
e2233db
adding curl to launch BP
shayrm Oct 12, 2023
6d05b42
updating test_curl action file
shayrm Oct 12, 2023
b7b2801
updating test_curl action file
shayrm Oct 12, 2023
e766081
updating test_curl action file
shayrm Oct 12, 2023
6b9f53c
updating test_curl action file
shayrm Oct 12, 2023
203e249
updating test_curl action file
shayrm Oct 12, 2023
39b15ba
updating test_curl action file
shayrm Oct 12, 2023
7af6cb9
updating test_curl action file and adding py
shayrm Oct 14, 2023
bb67c91
adding py option for REST request
shayrm Oct 14, 2023
638920f
update test_curl.yml
shayrm Oct 14, 2023
977b5bb
update test_curl.yml
shayrm Oct 14, 2023
625e9ef
update test_curl.yml
shayrm Oct 14, 2023
0030f26
update test_curl.yml
shayrm Oct 14, 2023
f5a3655
update test_curl.yml
shayrm Oct 14, 2023
911c6d8
update test_curl.yml
shayrm Oct 14, 2023
b8f010a
update test_curl.yml
shayrm Oct 14, 2023
b403667
Merge pull request #1 from shayrm/dev
shayrm Oct 14, 2023
c435643
updatestart_ssm_env_py.yml
shayrm Oct 14, 2023
844cb7e
Merge branch 'dev' into main
shayrm Oct 14, 2023
65afc81
updatestart_ssm_env_py.yml
shayrm Oct 14, 2023
3cf7070
updatestart_ssm_env_py.yml
shayrm Oct 14, 2023
ab358bf
updatestart_ssm_env_py.yml
shayrm Oct 14, 2023
a8cee96
updatestart_ssm_env_py.yml
shayrm Oct 14, 2023
149a771
updatestart_ssm_env_py.yml
shayrm Oct 14, 2023
64f1793
updatestart_ssm_env_py.yml
shayrm Oct 14, 2023
4d5ce6f
updatestart_ssm_env_py.yml
shayrm Oct 14, 2023
f682d1b
updatestart_ssm_env_py.yml
shayrm Oct 14, 2023
cc473e9
updating README excercise file
shayrm Oct 15, 2023
1fd15b1
updating README excercise file
shayrm Oct 15, 2023
b5f1491
update exercise readme and py workflow
shayrm Oct 15, 2023
e99ee50
update exercise readme and py workflow
shayrm Oct 15, 2023
f15e407
update exercise readme and py workflow
shayrm Oct 15, 2023
51ed7b1
update exercise readme and py workflow
shayrm Oct 15, 2023
c0d182f
update exercise readme and py workflow
shayrm Oct 15, 2023
3144804
update exercise readme and py workflow
shayrm Oct 15, 2023
9ab7b1a
update exercise readme and py workflow
shayrm Oct 15, 2023
968f526
update exercise readme and py workflow
shayrm Oct 15, 2023
c8f187b
update exercise README
shayrm Oct 15, 2023
1ef877b
update exercise README
shayrm Oct 15, 2023
41590b2
update exercise README
shayrm Oct 15, 2023
f5405db
update exercise README
shayrm Oct 15, 2023
98ba3f5
update exercise README
shayrm Oct 15, 2023
95b89fa
update exercise README
shayrm Oct 15, 2023
2771245
update exercise README
shayrm Oct 15, 2023
a7c35ce
update exercise README
shayrm Oct 15, 2023
c0ee9dd
Add imgs dir
shayrm Oct 18, 2023
a1a178d
Add imgs dir
shayrm Oct 18, 2023
a04b437
Update README with workflow yml file
shayrm Oct 18, 2023
de850f0
Update workflow with linter
shayrm Oct 18, 2023
a2c659f
Update code based on Linter
shayrm Oct 18, 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
1 change: 1 addition & 0 deletions .github/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
requests==2.22.0
18 changes: 18 additions & 0 deletions .github/workflows/code_linter_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
on:
push:
branches:
- main
jobs:
super-linter-code-verification:
name: Lint code base
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Run supper Linter
uses: github/super-linter@v4
env:
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_MARKDOWN: false
73 changes: 73 additions & 0 deletions .github/workflows/start_ssm_env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# This is a workflow that is manually triggered for starting ssm environment

####################################
# Workflow Metadata
###################################
name: Torque SSM environment with torque-start-environmen


###################################
# workflow inputs
###################################

on:
workflow_dispatch:
inputs:
space:
description: 'The name of the Torque Space your repository is connected to'
type: string
required: true
default: SM-SE-Candidate-Exercise
blueprint_name:
description: 'Provide blueprint name'
type: string
required: false
default: ssm
environment_name:
description: 'Provide environment name'
type: string
required: false
default: ssm_for_se_env_1
repo_name:
description: 'default repository name'
type: string
required: true
default: qtorque
aws_region:
description: 'AWS default region'
type: string
required: true
default: us-east-1
ssm_name:
description: 'Provide ssm key name name'
type: string
required: true
default: ssm_key_name
ssm_value:
description: 'Provide ssm value'
type: string
required: true
default: ssm_value_for_Shay_se

######################
# Jobs
######################
jobs:
test-ssm-with-torque:
runs-on: ubuntu-latest
steps:
- name: test-ssm-with-torque
id: start-env
uses: QualiTorque/torque-start-environment@v1
with:
space: ${{ inputs.space }}
torque_token: "${{ secrets.TORQUE_TOKEN }}"
blueprint_name: ${{ inputs.blueprint_name }}
repository_name: ${{ inputs.repo_name }}
inputs: 'aws_region="${{ inputs.aws_region }}",name="${{ inputs.ssm_name }}",value="${{ inputs.ssm_value }}",agent="Quali", AWS_ACCESS_KEY="${{ secrets.AWS_ACCESS_KEY }}",AWS_SECRET_KEY="${{ secrets.AWS_SECRET_KEY }}"'
torque_hostname: "portal.qtorque.io"
timeout: 15
duration: 60
outputs:
environment_name: ${{ inputs.environment_name }}
environment_id: ${{ steps.test-ssm-with-torque.outputs.environment_id }}
100 changes: 100 additions & 0 deletions .github/workflows/start_ssm_env_py.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
####################################
# Workflow Metadata
###################################
name: Torque SSM environment with python


###################################
# workflow inputs
###################################

on:
workflow_dispatch:
inputs:
aws_region:
description: 'AWS default region'
type: string
required: true
default: us-east-1
ssm_name:
description: 'Provide ssm key name name'
type: string
required: true
default: key_name_for_se
ssm_value:
description: 'Provide ssm value'
type: string
required: true
default: ssm_value_for_Shay_se_100

######################
# Jobs
######################
jobs:
run-python-script-for-ssm:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Copy requirements.txt to the current directory
run: cp .github/requirements.txt .
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run Python script - start new environment
id: python-script
uses: jannekem/run-python-script-action@v1
with:
script: |
import requests
import json
import os

url = "https://portal.qtorque.io/api/spaces/${{ vars.SPACE_NAME }}/environments"

payload = json.dumps({
"sandbox_name": "${{ vars.SENDBOX_NAME }}",
"environment_name": "${{ vars.ENVIRONMENT_NAME}}_${{ github.run_number }}",
"blueprint_name": "${{ vars.BLUEPRINT_NAME }}",
"description": "NA",
"owner_email": "${{ vars.OWNER_EMAIL}}",
"automation": True,
"duration": "${{ vars.DURATION }}",
"source": {
"blueprint_name": "${{ vars.BLUEPRINT_NAME }}",
"repository_name": "${{ vars.REPO_NAME }}",
"branch": "",
"commit": ""
},
"visibility": "",
"notes": "",
"inputs": {
"name": "${{ inputs.ssm_name }}",
"value": "${{ inputs.ssm_value }}",
"aws_region": "${{ inputs.aws_region }}",
"agent": "${{ vars.AGENT }}",
"AWS_ACCESS_KEY": "${{ secrets.AWS_ACCESS_KEY }}",
"AWS_SECRET_KEY": "${{ secrets.AWS_SECRET_KEY }}"
},
"compute_availability": 0
})
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer ${{ secrets.TORQUE_TOKEN }}'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)






109 changes: 109 additions & 0 deletions .github/workflows/test_curl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
####################################
# Workflow Metadata
###################################
name: Torque SSM environment with curl


###################################
# workflow inputs
###################################

on:
workflow_dispatch:
inputs:
space:
description: 'The name of the Torque Space your repository is connected to'
type: string
required: true
default: SM-SE-Candidate-Exercise
sendbox:
description: 'The name of the Torque sendbox'
type: string
required: true
default: shay_se_sandbox
blueprint_name:
description: 'Provide blueprint name'
type: string
required: false
default: ssm
environment_name:
description: 'Provide environment name'
type: string
required: false
default: ssm_for_se_env_1
repo_name:
description: 'default repository name'
type: string
required: true
default: qtorque
aws_region:
description: 'AWS default region'
type: string
required: true
default: us-east-1
ssm_name:
description: 'Provide ssm key name name'
type: string
required: true
default: ssm_key_name
ssm_value:
description: 'Provide ssm value'
type: string
required: true
default: ssm_value_for_Shay_se

######################
# Jobs
######################
jobs:
launch_torque_env:
runs-on: ubuntu-latest
env:
API_URL: 'https://portal.qtorque.io/api/spaces/${{ inputs.space }}/environments'
API_DATA: '{
"sandbox_name": "${{ inputs.sendbox }}",
"environment_name": "${{ inputs.environment_name }}",
"blueprint_name": "${{ inputs.blueprint_name }}",
"description": "NA",
"owner_email": "shayros@gmail.com",
"automation": True,
"duration": "PT15M",
"source": {
"blueprint_name": "${{ inputs.blueprint_name }}",
"repository_name": "${{ inputs.repo_name }}",
"branch": "",
"commit": ""
},
"visibility": "",
"notes": "",
"inputs": {
"name": "${{ inputs.ssm_name }}",
"value": "${{ inputs.ssm_value }}",
"aws_region": "${{ inputs.aws_region }}",
"agent": "Quali",
"AWS_ACCESS_KEY": "${{ secrets.AWS_ACCESS_KEY }}",
"AWS_SECRET_KEY": "${{ secrets.AWS_SECRET_KEY }}"
},
"compute_availability": 0
}'
steps:
- name: run blueprint ${{ inputs.blueprint_name}}
run: |
echo 'Got the following inputs- ${{ secrets.TORQUE_TOKEN }}, ${{secrets.AWS_ACCESS_KEY }}, ${{ secrets.AWS_SECRET_KEY }}, ${{ inputs.aws_region }}'
echo "will run curl to $API_URL"
echo "print the folloing data - $API_DATA"
RESPONSE=$(curl -s --trace -vvv --location --request POST $API_URL \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer ${{ secrets.TORQUE_TOKEN }}' \
--data-raw $API_DATA)

echo "{api-response}={RESPONSE}" >> $GITHUB_OUTPUT

ouputs-collector-job:
needs: launch_torque_env
runs-on: ubuntu-latest
steps:
- name: Access API Response
run: |
echo "API Response from the previous job: ${{ needs.launch_torque_env.outputs.api-response }}"
Loading