From 75ca4f97f5fa9ea42497dd0bc25979a4bce55fcb Mon Sep 17 00:00:00 2001 From: AnthonyEnr1quez <32233059+AnthonyEnr1quez@users.noreply.github.com> Date: Mon, 2 Oct 2023 12:03:39 -0500 Subject: [PATCH] add first custom script --- .../direnvs/mf/flake.nix | 19 ++++++---------- .../direnvs/mf/scripts/pdev-test.sh | 22 +++++++++++++++++++ .../direnvs/mf/scripts/simple-script.sh | 3 --- 3 files changed, 29 insertions(+), 15 deletions(-) create mode 100644 hosts/darwin/anthonyenriquez-MacBook-Pro/direnvs/mf/scripts/pdev-test.sh delete mode 100644 hosts/darwin/anthonyenriquez-MacBook-Pro/direnvs/mf/scripts/simple-script.sh diff --git a/hosts/darwin/anthonyenriquez-MacBook-Pro/direnvs/mf/flake.nix b/hosts/darwin/anthonyenriquez-MacBook-Pro/direnvs/mf/flake.nix index 0fd746f..0a75df7 100644 --- a/hosts/darwin/anthonyenriquez-MacBook-Pro/direnvs/mf/flake.nix +++ b/hosts/darwin/anthonyenriquez-MacBook-Pro/direnvs/mf/flake.nix @@ -12,11 +12,11 @@ bumper = pkgs.buildGoModule rec { pname = "bumper"; - version = "0.3.0"; + version = "0.4.0"; src = builtins.fetchGit { url = "git@github.com:moovfinancial/bumper.git"; ref = "v${version}"; - rev = "da5e33b2fd07ba3927004d4106f64d4dce5a2c2a"; + rev = "5aea0cecb5f946805539880602a9fe40eacc348d"; }; doCheck = false; vendorSha256 = "sha256-ix72uivcxw2TzYZnifjbjT0sogdZk5PNEEVpfgitJkY="; @@ -40,11 +40,12 @@ }; scriptDefs = { - simple-script = mkScriptPackage { - name = "simple-script"; + pdev-test = mkScriptPackage { + name = "pdev-test"; deps = [ - pkgs.cowsay - pkgs.ddate + bumper + pkgs.coreutils + pkgs.git ]; }; }; @@ -66,12 +67,6 @@ zstd bumper - ] ++ [ - (writeScriptBin "testing123" '' - tmp="bob" - echo hello $tmp! - which bump - '') ] ++ scripts; # env vars diff --git a/hosts/darwin/anthonyenriquez-MacBook-Pro/direnvs/mf/scripts/pdev-test.sh b/hosts/darwin/anthonyenriquez-MacBook-Pro/direnvs/mf/scripts/pdev-test.sh new file mode 100644 index 0000000..8d822f9 --- /dev/null +++ b/hosts/darwin/anthonyenriquez-MacBook-Pro/direnvs/mf/scripts/pdev-test.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +service_name=$(basename -s .git `git config --get remote.origin.url`) +short_sha=$(git rev-parse --short HEAD) + +dry_run="" +if [ "$1" = "-c" ]; then + dry_run="-n" +fi + +bumper_output=$( (bump deploy $dry_run pdev $service_name:dev-$short_sha | sort; ) 2>&1 ) + +if [ -z "$dry_run" ]; then + echo $(echo "$bumper_output" | grep "Created") +else + branch_name=$(echo "$bumper_output" | grep "checkout -b"| rev | cut -d " " -f1 | rev) + commit_msg=$(echo "$bumper_output" | grep "with message"| cut -d'"' -f 2) + + git -C $BUMPER_PD_PATH checkout -q -b $branch_name + git -C $BUMPER_PD_PATH commit -am "$commit_msg" > /dev/null + + echo "Created branch $branch_name in platform-dev, add your configs and push :)" +fi diff --git a/hosts/darwin/anthonyenriquez-MacBook-Pro/direnvs/mf/scripts/simple-script.sh b/hosts/darwin/anthonyenriquez-MacBook-Pro/direnvs/mf/scripts/simple-script.sh deleted file mode 100644 index 832938e..0000000 --- a/hosts/darwin/anthonyenriquez-MacBook-Pro/direnvs/mf/scripts/simple-script.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -DATE=$(ddate +'the %e of %B%, %Y') -cowsay Hello, world! Today is $DATE.