-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #258 from terrateamio/main
Release v1
- Loading branch information
Showing
10 changed files
with
106 additions
and
7 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
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#! /bin/sh | ||
|
||
export PATH="$PATH":/usr/local/proxy/bin | ||
|
||
WORK_TOKEN="$1" | ||
API_BASE_URL="$2" | ||
|
||
|
File renamed without changes.
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,19 @@ | ||
#! /usr/bin/env bash | ||
|
||
set -e | ||
set -u | ||
|
||
if [[ ! -f /usr/local/bin/resourcely-cli ]]; then | ||
flock /tmp/resourcely-install \ | ||
curl \ | ||
-s \ | ||
-L \ | ||
-o \ | ||
/tmp/resourcely-cli-v"$RESOURCELY_VERSION"-linux-amd64.tar.gz \ | ||
https://github.com/Resourcely-Inc/resourcely-container-registry/releases/download/v"$RESOURCELY_VERSION"/resourcely-cli-v"$RESOURCELY_VERSION"-linux-amd64.tar.gz | ||
|
||
flock /tmp/resourcely-install tar -xzf /tmp/resourcely-cli-v"$RESOURCELY_VERSION"-linux-amd64.tar.gz | ||
flock /tmp/resourcely-install mv resourcely-cli /usr/local/bin/ || true | ||
fi | ||
|
||
exec /usr/local/bin/resourcely-cli "$@" |
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 @@ | ||
import os | ||
import tempfile | ||
|
||
import workflow_step_run | ||
import workflow_step_terraform | ||
|
||
|
||
def run(state, config): | ||
result = workflow_step_terraform.run(state, | ||
{ | ||
'args': ['show', '-json', '$TERRATEAM_PLAN_FILE'], | ||
'output_key': 'plan_json' | ||
}) | ||
|
||
if result.failed: | ||
return result._replace(workflow_step={'type': 'resourcely'}) | ||
|
||
plan_json = result.outputs['text'] | ||
|
||
with tempfile.TemporaryDirectory() as tmpdir: | ||
json_file = os.path.join(tmpdir, 'json') | ||
with open(json_file, 'w') as f: | ||
f.write(plan_json) | ||
|
||
run_config = { | ||
'cmd': ['resourcely-cli', | ||
'--no_color', | ||
'evaluate', | ||
'--change_request_url', | ||
'https://github.com/{}/pull/{}'.format(state.env['GITHUB_REPOSITORY'], | ||
state.work_manifest['run_kind_data']['id']), | ||
'--change_request_sha', | ||
'${GITHUB_SHA}', | ||
'--plan', | ||
json_file], | ||
'capture_output': True | ||
} | ||
|
||
result = workflow_step_run.run(state, run_config) | ||
|
||
return result |
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