diff --git "a/.changes/unreleased/\360\237\244\226 Development-20230112-004952.yaml" "b/.changes/unreleased/\360\237\244\226 Development-20230112-004952.yaml" new file mode 100644 index 00000000..32173af0 --- /dev/null +++ "b/.changes/unreleased/\360\237\244\226 Development-20230112-004952.yaml" @@ -0,0 +1,11 @@ +kind: "\U0001F916 Development" +body: + Devcontainer attempts to mount existing dsv cli configuration from filestore + if this is available. This will ease local devcontainer usage setup and allow testing + and `$HOME/.envrc` configurations to be autoloaded. +time: 2023-01-12T00:49:52.438142024Z +custom: + azure-boards-workitemid-fixed: '' + azure-boards-workitemid-related: '' + github-contributor: sheldonhull + github-link: '' diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 26c3f3da..f74da846 100755 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -22,6 +22,8 @@ "source=${localEnv:HOME}${localEnv:USERPROFILE}/.kube,target=/home/vscode/.kube/,type=bind,consistency=cached", // support for SSH keys "source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh/,type=bind,consistency=cached", // support for SSH keys "source=${localEnv:HOME}${localEnv:USERPROFILE}/.envrc,target=/home/vscode/.envrc,type=bind,consistency=cached", // envrc from home to allow direnv to mount credentials + "source=${localEnv:HOME}${localEnv:USERPROFILE}/.thy,target=/home/vscode/.thy/,type=bind,consistency=cached", // support for dsv-cli filestore based store + "source=${localEnv:HOME}${localEnv:USERPROFILE}/.dsv.yml,target=/home/vscode/.dsv.yml/,type=bind,consistency=cached", // mounting for dsv-config // cache gopath directory "source=go-path,target=/home/vscode/go/,type=volume" ], diff --git a/.devcontainer/init b/.devcontainer/init index e611fb26..0a557344 100755 --- a/.devcontainer/init +++ b/.devcontainer/init @@ -3,4 +3,5 @@ touch "$HOME/.envrc" && echo "✅ $HOME/.envrc initialized" mkdir "$HOME/.ssh" || echo "✅ .ssh dir already exists" mkdir "$HOME/.kube" || echo "✅ .kube dir already exists" +mkdir "$HOME/.thy" || echo "✅ .thy dir already exists" echo '✅ prep.sh setup complete' diff --git a/.devcontainer/init.bat b/.devcontainer/init.bat index d4f2a1ac..676ae7a0 100755 --- a/.devcontainer/init.bat +++ b/.devcontainer/init.bat @@ -1,2 +1,2 @@ -powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "New-Item (Join-Path $ENV:USERPROFILE '.ssh') -ItemType Directory -EA 0; New-Item (Join-Path $ENV:USERPROFILE '.envrc') -ItemType File -EA 0; New-Item (Join-Path $ENV:USERPROFILE '.kube') -ItemType Directory -EA 0;" +powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "New-Item (Join-Path $ENV:USERPROFILE '.ssh') -ItemType Directory -EA 0; New-Item (Join-Path $ENV:USERPROFILE '.envrc') -ItemType File -EA 0; New-Item (Join-Path $ENV:USERPROFILE '.kube') -ItemType Directory -EA 0;New-Item (Join-Path $ENV:USERPROFILE '.thy') -ItemType Directory -EA 0; New-Item (Join-Path $ENV:USERPROFILE '.dsv.yml') -ItemType File -EA 0" echo '✅ prep setup complete' \ No newline at end of file diff --git a/.envrc b/.envrc index 628a7781..2b0b32c8 100644 --- a/.envrc +++ b/.envrc @@ -1,6 +1,12 @@ +export PATH="${AQUA_ROOT_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/aquaproj-aqua}/bin:$PATH" # for those using aqua this will ensure it's in the path export DIRENV_LOG_FORMAT="" export DIRENV_WARN_TIMEOUT='10s' dotenv_if_exists "${HOME}/.env" source_env_if_exists "${HOME}/.envrc" export PATH="${GOPATH}/bin:${PATH}" export MAGEFILE_ENABLE_COLOR=1 +export MAGEFILE_HASHFAST=1 + +# friendly helpers for devs + +alias tcc='trunk check --ci' diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 5cad7ee5..2bbdd228 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -63,6 +63,7 @@ lint: paths: - .devcontainer/init - vendor/* + - '**/*/mage_output_file.go' - linters: [yamllint] paths: - .changes/unreleased/*.yaml diff --git a/README.md b/README.md index a3d2302e..7bf127d3 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ An automation tool for the management of credentials for applications, databases - Curl (requires Go installed): ```shell + go install github.com/mikefarah/yq/v4@latest version=$(curl -sb -H "Accept: application/json" https://s3.amazonaws.com/dsv.secretsvaultcloud.com/cli-version.json | $(go env GOPATH)/bin/yq '.latest') echo "version: $version" curl -fSsl https://dsv.secretsvaultcloud.com/downloads/cli/$version/dsv-darwin-x64 -o dsv && chmod +x ./dsv && sudo mv ./dsv /usr/local/bin diff --git a/aqua.yaml b/aqua.yaml index cec6d79c..48fc08f4 100644 --- a/aqua.yaml +++ b/aqua.yaml @@ -3,7 +3,7 @@ # https://aquaproj.github.io/ registries: - type: standard - ref: v3.118.0 # renovate: depName=aquaproj/aqua-registry + ref: v3.120.0 # renovate: depName=aquaproj/aqua-registry packages: - name: miniscruff/changie@v1.10.2 tags: ['ci'] @@ -38,3 +38,5 @@ packages: - name: charmbracelet/gum@v0.8.0 - name: DelineaXPM/dsv-cli@v1.39.13 tags: ['ci'] + - name: sharkdp/hyperfine@v1.15.0 + - name: mikefarah/yq@v4.30.6 diff --git a/magefiles/magefile.go b/magefiles/magefile.go index 2ea7b0e8..8a394fbd 100644 --- a/magefiles/magefile.go +++ b/magefiles/magefile.go @@ -132,6 +132,13 @@ func Init() error { } pterm.Success.Println("snapcraft installed") } + // Aqua install is run in devcontainer/codespace automatically. + // If this environment isn't being used, try to jump start, but if failure, output warning and let the developer choose if they want to go install or not. + if err := sh.RunV("aqua", "install"); err != nil { + pterm.Warning.Printfln("aqua install not successful.\n" + + "This is optional, but will ensure every tool for the project is installed and matching version." + + "To install see developer docs or go to https://aquaproj.github.io/docs/reference/install") + } pterm.Success.Printfln("Init() completed [%s]\n", relTime(start)) return nil } @@ -145,3 +152,8 @@ func InstallTrunk() error { return nil } + +// TrunkInit ensures the required runtimes are installed. +func TrunkInit() error { + return sh.RunV("trunk", "install") +}