forked from github-aws-runners/terraform-aws-github-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main'
- Loading branch information
Showing
204 changed files
with
21,652 additions
and
6,308 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script will run terraform init in all subdirectories of the examples directory | ||
# required to run tflint via pre-commit | ||
|
||
# only run the script if a uniique pid file exits if not creat it or --force flag is passed | ||
pid="/tmp/philips-labs-terraform-aws-github-runner.pid" | ||
if [ "$1" == "--force" ]; then | ||
rm -f /tmp/philips-labs-terraform-aws-github-runner.pid | ||
fi | ||
|
||
if [ ! -f $pid ]; then | ||
echo $$ > $pid | ||
else | ||
echo "Init all terraform directories will be skipped. To run the script remove the file $pid or run with --force" | ||
exit 0 | ||
fi | ||
|
||
# Change to the examples directory | ||
example_dirs=$(find examples -mindepth 1 -maxdepth 2 -type d | grep -v "templates") | ||
module_dirs=$(find modules -mindepth 1 -maxdepth 2 -type d | grep -v "templates") | ||
|
||
# merge example_dirs and module_dirs in terraform_dirs | ||
terraform_dirs=$(echo $example_dirs $module_dirs "modules/runners/pool" | tr " " "\n" | sort -u | tr "\n" " ") | ||
|
||
for dir in $terraform_dirs; do | ||
# Check if the subdirectory exists in Git | ||
if git rev-parse --is-inside-work-tree &>/dev/null && git ls-files --error-unmatch "$dir" &>/dev/null; then | ||
echo "Running terraform init in ${dir} - supressing output" | ||
pushd "$dir" >/dev/null | ||
terraform init -lockfile=readonly -backend=false &>/dev/null || true | ||
popd >/dev/null | ||
fi | ||
done |
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,2 @@ | ||
ARG VARIANT="20-bullseye" | ||
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT} |
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,17 @@ | ||
open_workspace() { | ||
local workspace_file=$WORKSPACE/.vscode/gh-runners.code-workspace | ||
|
||
if ! [ -f "$workspace_file" ]; then | ||
echo "🔴 Missing workspace file" | ||
return 1 | ||
fi | ||
|
||
echo "🟡 Opening workspace" | ||
if code "$workspace_file"; then | ||
echo "🟢 Workspace opened" | ||
return 0 | ||
else | ||
echo "🔴 Failed to open workspace" | ||
return 1 | ||
fi | ||
} |
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,32 @@ | ||
{ | ||
"name": "GitHub Runners AWS", | ||
"build": { "dockerfile": "Dockerfile" }, | ||
"features": { | ||
"ghcr.io/devcontainers/features/github-cli:1": {}, | ||
"ghcr.io/devcontainers/features/terraform:1": {} | ||
}, | ||
|
||
"containerEnv": { | ||
"WORKSPACE": "${containerWorkspaceFolder}" // e.g. /workspaces/my-project | ||
}, | ||
|
||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"dbaeumer.vscode-eslint", | ||
"editorconfig.editorconfig", | ||
"esbenp.prettier-vscode", | ||
"firsttris.vscode-jest-runner", | ||
"hashicorp.hcl", | ||
"hashicorp.terraform", | ||
"hashicorp.terraform", | ||
"orta.vscode-jest", | ||
"yzhang.markdown-all-in-one" | ||
] | ||
} | ||
}, | ||
"postCreateCommand": { | ||
"bash_command": "bash ${containerWorkspaceFolder}/.devcontainer/postCreateScript.sh", | ||
"welcome": "sudo cp -v .devcontainer/welcome.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt || true && sudo cp -v .devcontainer/welcome.txt /workspaces/.codespaces/shared/first-run-notice.txt || 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
printf "source \$WORKSPACE/.devcontainer/bashrc.sh\n" >> ~/.bashrc |
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,53 @@ | ||
================================================================================ | ||
================================================================================ | ||
=====================================================++++**+++================== | ||
=================================================+++++=********+================ | ||
=============================================+***+=--:-#********+=============== | ||
==========================================+***+=--:::::-+*#*****+=============== | ||
=======================================+*#%*=--:::::::::::-=====+=============== | ||
=====================================+#%%##%*-:::::::::::::::::+================ | ||
===========================++======*#%%#######=-::::::::::::::=+================ | ||
=======================++==---::-+#%%###########+-:::::::::::-+================= | ||
====================+==-::::::-=#%%################+=::::::::+================== | ||
=================++=-:::::::-=#%%%####%%##**########%#*++=-:++================== | ||
===============+=-:::-------*%%%###%%%#=:...:-*############*+=================== | ||
=====. .-====-:--++***+++#%%###%#%%+: .-*###########+==================== | ||
===-. --:-++**+=====+%%%###%%#%*- :*#########*====================== | ||
=== .:==++=========*%%%#####%#%*=. .=#########*======================= | ||
===: :: .==========+%%%%#####%%%%#+=-:::-+#########+======================== | ||
====: :=========#%%%%#####%#**#####*##########+========================== | ||
==== .=========%%%%%####*+=*%##############============================= | ||
====-.... :--------=##%%%%#*==*%##############=::++========================== | ||
========--::---------=-=#%%%#+=#%#############*=-::-*=========================== | ||
======------------=+*=---*#++*%#############+-:::::++=========================== | ||
=====----------=+*+=+---=++*%%%%#########**+-:::::++============================ | ||
===----------+*+=-+*+-=+=*#+=*%%%%%%%#*+==+#=:::-*+============================= | ||
==---------+**+-=**+===**=-=--=+***+======#+-::=+=============================== | ||
==----------+=-=**=:=+*=--++---==========**=:-++================================ | ||
=---------=*=-=**=::::--=*+----=-:::-===**=-=+================================== | ||
=--------=*=-+**+::-=*+=*+-----=. ..=+==+==================================== | ||
=-------==--***+=+**=*+*=------. -+=..===================================== | ||
=------=--=***+**+=-+*+------==. .=+: .===================================== | ||
=--------=*****+---++=-----===== .=: :====================================== | ||
==------=***+=----==-----======- -======================================= | ||
===----=*+=------=-----=========: .======================================== | ||
====--==------------==============--============================================ | ||
======--------================================================================== | ||
================================================================================ | ||
================================================================================ | ||
================================================================================ | ||
================================================================================ | ||
==========================================================================-:-=++ | ||
|
||
|
||
Welcome to the AWS GitHub runners: | ||
|
||
Load the vscode workspace to get started | ||
|
||
Option 1: run `open_workspace` | ||
Option 2: open the workspace file `.vscoe/gh-runners.code-workspace` and load the workspace | ||
|
||
Build the lambda: | ||
- cd lambdas | ||
- yarn instal & yarn run dist | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,38 +16,48 @@ jobs: | |
name: Auto update terraform docs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get installation token | ||
uses: philips-software/app-token-action@a37926571e4cec6f219e06727136efdd073d8657 # ratchet:philips-software/[email protected] | ||
id: token | ||
with: | ||
app_id: ${{ secrets.FOREST_RELEASER_APP_ID }} | ||
app_base64_private_key: ${{ secrets.FOREST_RELEASER_APP_PRIVATE_KEY_BASE64 }} | ||
auth_type: installation | ||
|
||
# We use the app for branches in this this repo to ensure PR chekcs are kept in place. | ||
- if: github.event_name == 'push' && github.repository_owner == 'philips-labs' && github.ref != 'refs/heads/main' | ||
name: Checkout with App Token | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v4 | ||
with: | ||
token: ${{ steps.token.outputs.token }} | ||
|
||
- if: (github.event_name == 'push' && github.repository_owner != 'philips-labs') || github.ref == 'refs/heads/main' | ||
name: Checkout with GITHUB Action token | ||
- name: Checkout with GITHUB Action token | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v4 | ||
|
||
- name: Generate TF docs | ||
uses: terraform-docs/gh-actions@f6d59f89a280fa0a3febf55ef68f146784b20ba0 # ratchet:terraform-docs/[email protected] | ||
with: | ||
find-dir: . | ||
git-commit-message: "docs: auto update terraform docs" | ||
git-push: ${{ github.ref != 'refs/heads/main' }} | ||
git-push: ${{ github.ref != 'refs/heads/main' || github.repository_owner != 'philips-labs' }} | ||
|
||
# change docs via PR in case of locked main branch | ||
- name: Create Pull Request (main branch only) | ||
if: github.ref == 'refs/heads/main' | ||
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # ratchet:peter-evans/create-pull-request@v5.0.2 | ||
if: github.ref == 'refs/heads/main' && github.repository_owner == 'philips-labs' | ||
uses: peter-evans/create-pull-request@b1ddad2c994a25fbc81a28b3ec0e368bb2021c50 # ratchet:peter-evans/create-pull-request@v6.0.0 | ||
with: | ||
token: ${{ steps.token.outputs.token || secrets.GITHUB_TOKEN }} | ||
commit-message: "Update Terraform docs" | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: "docs: auto update terraform docs" | ||
title: "docs: Update Terraform docs" | ||
branch: ${{ github.event.pull_request.base.ref }}-update-docs | ||
branch: update-docs | ||
branch-suffix: random | ||
base: ${{ github.event.pull_request.base.ref }} | ||
delete-branch: true | ||
|
||
deploy-pages: | ||
needs: [docs] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v4 | ||
- name: Configure Git Credentials | ||
run: | | ||
git config user.name github-actions[bot] | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.x | ||
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | ||
- uses: actions/cache@v4 | ||
with: | ||
key: mkdocs-material-${{ env.cache_id }} | ||
path: .cache | ||
restore-keys: | | ||
mkdocs-material- | ||
- run: pip install mkdocs-material | ||
- run: pip install mkdocs-material-extensions | ||
- run: mkdocs gh-deploy --force -c -b gh-pages |
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 |
---|---|---|
|
@@ -22,3 +22,4 @@ secrets.auto.tfvars | |
**/coverage/* | ||
|
||
node_modules/ | ||
site/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.