Skip to content

Commit

Permalink
⤵️ automation(synchronize) Applying changes from upstream repository.
Browse files Browse the repository at this point in the history
  • Loading branch information
Megabyte Labs committed Mar 11, 2022
1 parent c06d98e commit f66fd0f
Show file tree
Hide file tree
Showing 46 changed files with 1,610 additions and 573 deletions.
18 changes: 12 additions & 6 deletions .config/Brewfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
# Standard Homebrew taps
tap "homebrew/cask"
tap "homebrew/core"
tap "homebrew/bundle"
tap "homebrew/services"
tap "caskroom/cask"

# Homebrew Formulae
# e.g. `brew install <program>`
# @brew [act](https://github.com/nektos/act) - Run GitHub Actions locally
brew "act"
# @brew [appium](https://appium.io/) - A framework focused on native Android/iOS testing
brew "appium"
# @brew [azure-cli](https://docs.microsoft.com/en-us/cli/azure/) - The official CLI for interacting with Microsoft Azure
brew "azure-cli"
# @brew [bat](https://github.com/sharkdp/bat) - Clone of cat with syntax highlighting and Git integration
brew "bat"
# @brew [bitwarden-cli](https://github.com/bitwarden/cli) - Access and manage a BitWarden instance via CLI
brew "bitwarden-cli"
# @brew [codeclimate](https://github.com/codeclimate/codeclimate) - Interact with CodeClimate via CLI
tap "codeclimate/formulae"
brew "codeclimate"
# @brew [croc](https://github.com/schollz/croc) - A sharing tool that helps transfer files from one computer to another
brew "croc"
Expand All @@ -34,13 +36,12 @@ end
# @brew [docker-slim](https://github.com/docker-slim/docker-slim) - A tool that shrinks Docker images and makes them more secure
brew "docker-slim"
# @brew [Dockle](https://github.com/goodwithtech/dockle) - A container image security scanner
tap "goodwithtech/r"
brew "goodwithtech/r/dockle"
# @brew [exiftool](https://exiftool.org) - A library for reading and writing EXIF data to files
brew "exiftool"
# @brew [ffsend](https://github.com/timvisee/ffsend) - Fully featured Firefox Send client that makes sharing files easy
brew "ffsend"
# @brew [gcloud](https://cloud.google.com/sdk/gcloud) - The official Google Cloud Platform SDK CLI tool
brew "gcloud"
# @brew [gh](https://github.com/cli/cli) - The official GitHub command line tool
brew "gh"
# @brew [git](https://git-scm.com) - Tool for interacting with git repositories
Expand Down Expand Up @@ -69,6 +70,7 @@ brew "jq"
brew "kubectx"
brew "kubernetes-cli"
# @brew [mc](https://github.com/minio/mc) - Replacement for ls, cp and other commands that are compatible with file-system-mounted S3 buckets
tap "minio/stable"
brew "minio/stable/mc"
# @brew [mkcert](https://github.com/FiloSottile/mkcert) - Simple tool to make locally trusted development certificates
brew "mkcert"
Expand All @@ -81,7 +83,7 @@ brew "ots"
# @brew [oq](https://blacksmoke16.github.io/oq) - Performant, and portable jq wrapper that supports formats other than JSON
brew "oq"
# @brew [php](https://www.php.net/) - General-purpose scripting language
brew "php", restart_service: true
# brew "php", restart_service: false
# @brew [poetry](https://python-poetry.org/) - A Python project package management tool and more
brew "poetry"
# @brew [pup](https://github.com/EricChiang/pup) - Parse HTML with a CLI
Expand All @@ -92,24 +94,26 @@ brew "[email protected]"
brew "rsync"
# @brew [ruby](https://www.ruby-lang.org/) - Powerful, clean, object-oriented scripting language
brew "ruby"
# @brew [sentry-cli](https://github.com/getsentry/sentry-cli) - Interact with Sentry via a CLI
brew "getsentry/tools/sentry-cli"
# @brew [sshpass](https://github.com/hudochenkov/homebrew-sshpass) - Library that allows Ansible to connect over SSH with a password
tap "hudochenkov/sshpass"
brew "hudochenkov/sshpass/sshpass"
# @brew [sysbench](https://github.com/akopytov/sysbench) - System performance benchmark tool
brew "sysbench"
# @brew [task](https://github.com/go-task/homebrew-tap) - A parallel task runner
tap "go-task/tap"
brew "go-task/tap/go-task"
# @brew [teleport](https://github.com/bbatsche/homebrew-teleport) - An identity-aware SSH client for teams
brew "teleport"
brew "terraform"
# @brew [tokei](https://github.com/XAMPPRocky/tokei) - Count and display the lines of code and the language used in a project
brew "tokei"
# @brew [trivy](https://aquasecurity.github.io/trivy/v0.18.3/) - Scan images for vulnerabilities
tap "aquasecurity/trivy"
brew "aquasecurity/trivy/trivy"
# @brew [up](https://github.com/akavel/up) - Write Linux pipes with an instant live preview
brew "up"
# @brew [waypoint](https://www.waypointproject.io/) - Tool to build, deploy, and release any application on any platform
tap "hashicorp/tap"
brew "hashicorp/tap/waypoint"
# @brew [wireshark](https://www.wireshark.org) - Graphical network analyzer and capture tool (CLI)
if OS.linux?
Expand Down Expand Up @@ -140,6 +144,8 @@ cask "firefox"
cask "gimp"
# @cask [google-chrome](https://www.google.com/chrome/) - Sandbox-based web browser published by Google
cask "google-chrome"
# @cask [gcloud](https://cloud.google.com/sdk/gcloud) - The official Google Cloud Platform SDK CLI tool
cask "google-cloud-sdk"
# @cask [iterm2](https://www.iterm2.com/) - An improved terminal for macOS
cask "iterm2"
# @cask [java](https://www.java.com/en/) - Libraries required for running and developing Java applications
Expand Down
2 changes: 1 addition & 1 deletion .config/docs/readme-playbook/quick-description.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
> <br/>**A no-stone-unturned Ansible playbook you can use to set up the ultimate home lab or on-premise addition to your cloud!**<br/><br/>
> <br/><h4 align="center">**A no-stone-unturned Ansible playbook you can use to set up the ultimate home lab or on-premise addition to your cloud!**</h4><br/><br/>
2 changes: 2 additions & 0 deletions .config/docs/variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@
"scriptsBuild": "task donothing",
"scriptsHelp": "task --menu",
"scriptsPrepare": "npm run start && (test -f Taskfile.yml && task common:husky) || true",
"scriptsReplaceThis": "\"",
"scriptsReplaceWith": "\\\"",
"scriptsStart": "bash start.sh",
"scriptsTest": "task donothing",
"sharp_instructions": [],
Expand Down
2 changes: 1 addition & 1 deletion .config/log
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# * `warn` - Logs a warning message
# * `md` - Log a stylized markdown string or file

# @description Installs Stylog from GitHub releases
# @description Installs Stylog (a logging CLI) from GitHub releases
# @example installStylog
installStylog() {
true
Expand Down
8 changes: 4 additions & 4 deletions .config/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ansible-core==2.11.8; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
ansible-core==2.11.9; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
ansible==4.10.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
certifi==2021.10.8; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6"
cffi==1.15.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
charset-normalizer==2.0.11; python_full_version >= "3.6.0" and python_version >= "3.6"
charset-normalizer==2.0.12; python_full_version >= "3.6.0" and python_version >= "3.6"
cryptography==36.0.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
docker==5.0.3; python_version >= "3.6"
idna==3.3; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6"
jinja2==3.0.3; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
markupsafe==2.0.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
markupsafe==2.1.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7"
ntlm-auth==1.5.0; python_version >= "2.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0"
packaging==21.3; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
pycparser==2.21; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
Expand All @@ -21,5 +21,5 @@ requests==2.27.1; python_version >= "3.6" and python_full_version < "3.0.0" or p
resolvelib==0.5.5; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
six==1.16.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0"
urllib3==1.26.8; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version < "4" and python_version >= "3.6"
websocket-client==1.2.3; python_version >= "3.6"
websocket-client==1.3.1; python_version >= "3.6"
xmltodict==0.12.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0"
25 changes: 18 additions & 7 deletions .config/scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ if [ "$EUID" -eq 0 ] && [ -z "$INIT_CWD" ] && type useradd &> /dev/null; then
# shellcheck disable=SC2016
logger info 'Running as root - creating seperate user named `megabyte` to run script with'
echo "megabyte ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
useradd -m -s "$(which bash)" -c "Megabyte Labs Homebrew Account" megabyte
useradd -m -s "$(which bash)" -c "Megabyte Labs Homebrew Account" megabyte > /dev/null || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
# shellcheck disable=SC2016
logger info 'User `megabyte` already exists'
fi
ensureRootPackageInstalled "sudo"
# shellcheck disable=SC2016
logger info 'Reloading the script with the `megabyte` user'
Expand Down Expand Up @@ -258,7 +262,12 @@ function installTask() {
mkdir -p "$TARGET_BIN_DIR"
fi
mv "$TMP_DIR/task/task" "$TARGET_DEST"
logger success "Installed Task to $TARGET_DEST"
if type sudo &> /dev/null && sudo -n true; then
sudo mv "$TARGET_DEST" /usr/local/bin/task
logger success "Installed Task to /usr/local/bin/task"
else
logger success "Installed Task to $TARGET_DEST"
fi
rm "$CHECKSUM_DESTINATION"
rm "$DOWNLOAD_DESTINATION"
}
Expand Down Expand Up @@ -343,7 +352,7 @@ fi
if [[ "$OSTYPE" == 'darwin'* ]] || [[ "$OSTYPE" == 'linux-gnu'* ]] || [[ "$OSTYPE" == 'linux-musl'* ]]; then
if [ -z "$INIT_CWD" ]; then
if ! type brew &> /dev/null; then
if sudo -n true; then
if type sudo &> /dev/null && sudo -n true; then
echo | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
logger warn "Homebrew is not installed. The script will attempt to install Homebrew and you might be prompted for your password."
Expand Down Expand Up @@ -390,10 +399,12 @@ fi
ensureTaskInstalled

# @description Run the start logic, if appropriate
if [ -z "$GITLAB_CI" ] && [ -z "$INIT_CWD" ] && [ -f Taskfile.yml ]; then
if [ -z "$CI" ] && [ -z "$INIT_CWD" ] && [ -f Taskfile.yml ]; then
# shellcheck disable=SC1091
. "$HOME/.profile"
task start
# shellcheck disable=SC2016
logger info 'There may have been changes to your PATH variable. You may have to reload your terminal or run:\n\n`. "$HOME/.profile"`'
if task donothing &> /dev/null; then
task start
# shellcheck disable=SC2016
logger info 'There may have been changes to your PATH variable. You may have to reload your terminal or run:\n\n`. "$HOME/.profile"`'
fi
fi
14 changes: 14 additions & 0 deletions .config/taskfiles/ansible/Taskfile-ansibler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,24 @@ tasks:
jq -s -S '.[0] + .[1]' '{{.VARIABLES_PATH}}' .cache/compatibility-chart.json > "$TMP"
mv "$TMP" '{{.VARIABLES_PATH}}'
compatibility-chart:ansifilter:
deps:
- :install:software:ansifilter
cmds:
- |
for LOG in {{.MOLECULE_RESULTS_PATH}}; do
if [ "$LOG" != '{{.MOLECULE_RESULTS_PATH}}' ]; then
TMP="$(mktemp)" && cat "$LOG" | ansifilter > "$TMP" && mv "$TMP" "$LOG"
fi
done
sources:
- '{{.MOLECULE_RESULTS_PATH}}/*'

compatibility-chart:generate:
deps:
- :install:python:requirements
cmds:
- task: compatibility-chart:ansifilter
- >
{{.PYTHON_HANDLE}}ansibler --generate-compatibility-chart --molecule-results-dir '{{.MOLECULE_RESULTS_PATH}}'
--json-file .cache/compatibility-chart.json
Expand Down
35 changes: 33 additions & 2 deletions .config/taskfiles/ansible/Taskfile-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,8 @@ tasks:
deps:
- :install:software:git
- :install:software:jq
- :install:software:subrepo
summary: |
# Ensures each role is added as a remote
# Ensures each role is added as a remote and a sub-repo (if applicable)
This task cycles through all the roles in the `/roles` folder and ensures
they are added as remotes. This helps with managing the git trees used
Expand All @@ -184,6 +183,9 @@ tasks:
else
git remote add "$ROLE_FOLDER" "$ROLE_SSH_REPO"
fi
if [ -d $ROLE_RELATIVE_PATH/.git ] && [ ! -f $ROLE_RELATIVE_PATH/.gitrepo ]; then
task ansible:playbook:subrepo:init -- $ROLE_RELATIVE_PATH
fi
else
.config/log warn "${ROLE_RELATIVE_PATH}/package.json is missing!"
fi
Expand Down Expand Up @@ -250,3 +252,32 @@ tasks:
- task: run:cli
vars:
CLI_ARGS: '{{.ANSWER}}'

subrepo:init:
deps:
- :install:software:subrepo
summary: |
# Add Role as a Sub-Repository
Since roles should each have their own repository for Ansible Galaxy and to make it easier
for the community to download specific roles, they must be declared as sub-repositories.
Submodules could also be used but we use sub-repos instead because they are more flexible.
In the main playbook, if someone clones the playbook, the playbook and all the roles will download
without any requirement to initialize submodules. At the same time, each role can be in its own
repository. The playbook recognizes roles like this because they have a `.gitrepo` file that is only
saved in the playbook version of the role. Users can interact with the playbook and its role
repositories transparently without any need to understand what git subrepos are.
Managers of roles can update the role repositories without any need to understand what git subrepos
are. Managers of the playbook can use the tool [git-subrepo](https://github.com/ingydotnet/git-subrepo)
to perform various actions including pulling changes from individual role repositories and
other actions.
Usage:
`task ansible:playbook:subrepo:init -- path/to/folder/with.git/folder`
cmds:
- |
BASENAME="$(basename {{.CLI_ARGS}})"
REMOTE="$(git remote get-url $BASENAME)"
HUSKY=0 git subrepo init {{.CLI_ARGS}} -r "$REMOTE" -b master
Loading

0 comments on commit f66fd0f

Please sign in to comment.