From 01fb85d2b94bd6070cd10d59c1919f352d157127 Mon Sep 17 00:00:00 2001 From: Silvestre Zabala Date: Wed, 22 May 2024 11:18:25 +0200 Subject: [PATCH] feat(devbox): Add Cloud MTA Build Tool to devbox # Issue For building MTAs the Cloud MTA Build Tool is required. # Fix Add it via local flake --- devbox.json | 79 +++++++++++++++++++++--------------------- local-flake/flake.nix | 24 +++++++++++++ scripts/asdf2devbox.py | 6 +--- 3 files changed, 65 insertions(+), 44 deletions(-) diff --git a/devbox.json b/devbox.json index 963a033274..5e0feda74e 100644 --- a/devbox.json +++ b/devbox.json @@ -1,43 +1,44 @@ { - "packages": [ - "path:local-flake#bosh-bootloader", - "path:local-flake#app-autoscaler-cli-plugin", - "path:local-flake#log-cache-cli-plugin", - "path:local-flake#uaac", - "delve@latest", - "gh@latest", - "go-tools@latest", - "gopls@latest", - "nodejs@latest", - "nodePackages.yaml-language-server@latest", - "rubocop@latest", - "rubyPackages.solargraph@latest", - "swagger-cli@latest", - "actionlint@1.6.27", - "direnv@2.34.0", - "gnumake@4.4", - "maven@3.8.6", - "pre-commit@latest", - "bosh-cli@7.3.1", - "golangci-lint@1.57.2", - "yq-go@4.43.1", - "which@latest", - "jq@latest", - "fly@7.10.0", - "python@latest", - "cloudfoundry-cli@8.7.10", - "shellcheck@0.10.0", - "go@1.21.5", - "ruby@3.3.1", - "bundix@latest", - "oha@latest", - "credhub-cli@2.9.29", - "gum@0.13.0", - "act@latest", - "google-cloud-sdk@latest", - "ginkgo@2.19.0", - "temurin-bin-17@latest" - ], + "packages": { + "path:local-flake#bosh-bootloader": "", + "path:local-flake#app-autoscaler-cli-plugin": "", + "path:local-flake#log-cache-cli-plugin": "", + "path:local-flake#cloud-mta-build-tool": "", + "path:local-flake#uaac": "", + "credhub-cli": "2.9.29", + "delve": "latest", + "gh": "latest", + "go-tools": "latest", + "gopls": "latest", + "nodejs": "latest", + "nodePackages.yaml-language-server": "latest", + "rubocop": "latest", + "rubyPackages.solargraph": "latest", + "swagger-cli": "latest", + "actionlint": "1.6.27", + "direnv": "2.34.0", + "gnumake": "4.4", + "maven": "3.8.6", + "pre-commit": "latest", + "bosh-cli": "7.3.1", + "golangci-lint": "1.57.2", + "yq-go": "4.43.1", + "which": "latest", + "jq": "latest", + "fly": "7.10.0", + "python": "latest", + "cloudfoundry-cli": "8.7.10", + "shellcheck": "0.10.0", + "go": "1.21.5", + "ruby": "3.3.1", + "ginkgo": "2.19.0", + "bundix": "latest", + "oha": "latest", + "gum": "0.13.0", + "act": "latest", + "google-cloud-sdk": "latest", + "temurin-bin-17": "latest" + }, "shell": { "init_hook": [ "cf install-plugin -f $(which app-autoscaler-cli-plugin)", diff --git a/local-flake/flake.nix b/local-flake/flake.nix index ff108fd774..61804f71c9 100644 --- a/local-flake/flake.nix +++ b/local-flake/flake.nix @@ -58,6 +58,30 @@ ldflags = ["-s" "-w" "-X main.version=${version}"]; }; + cloud-mta-build-tool = nixpkgsFor.${system}.buildGoModule rec { + pname = "Cloud MTA Build Tool"; + version = "1.2.26"; + + src = nixpkgsFor.${system}.fetchFromGitHub { + owner = "SAP"; + repo = "cloud-mta-build-tool"; + rev = "v${version}"; + hash = "sha256-DKZ9Nj/sNC9dRjyiu4MKjLrIJWluYlZzUHWqEqtrNt4="; + }; + + vendorHash = "sha256-h8LPsuxvbr/aRhH1vR1fYgBot37yrfiemZTJMKj0zbk="; + + ldflags = ["-s" "-w" "-X main.Version=${version}"]; + + doCheck = false; + + postInstall = '' + pushd "$out/bin" &> /dev/null + ln -s 'cloud-mta-build-tool' 'mbt' + popd + ''; + }; + uaac = nixpkgsFor.${system}.bundlerApp rec { pname = "cf-uaac"; gemdir = ./.; diff --git a/scripts/asdf2devbox.py b/scripts/asdf2devbox.py index c8fec97260..49759d6eb6 100755 --- a/scripts/asdf2devbox.py +++ b/scripts/asdf2devbox.py @@ -11,10 +11,7 @@ def get_installed_version(package): with open(os.path.join(script_dir, '..', 'devbox.json'), 'r') as f: data = json.load(f) - for pkg in data['packages']: - if pkg.startswith(f"{package}@"): - return pkg.split('@')[1] - return None + return data['packages'][package] # Read the .tool-versions file and process each line if __name__ == "__main__": @@ -27,7 +24,6 @@ def get_installed_version(package): "bosh": "bosh-cli", "cf": "cloudfoundry-cli", "concourse": "fly", - "concourse": "fly", "credhub": "credhub-cli", "gcloud": "google-cloud-sdk", "golang": "go",