From ae042af3433a12c5fb34f288e60ca1f781157674 Mon Sep 17 00:00:00 2001 From: Johan van Overbeeke Date: Sat, 2 Nov 2024 23:30:56 +0100 Subject: [PATCH 1/3] Initial straight copy-paste from mcmain repo --- Taskfile | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Taskfile b/Taskfile index 51f4fa4..555149b 100755 --- a/Taskfile +++ b/Taskfile @@ -74,6 +74,42 @@ function task:production { ## Build and run production output docker run --rm --publish 3089:80 --name tasksite --volume ./out:/var/www nstapelbroek/static-webserver:5 } +# Todo: Token als je meerdere Jira-omgevingen hebt +function task:jira:init { + title "Setting up Jira integration" + mkdir -p ~/.config/.jira + if [ ! -f ~/.config/.jira/token ]; then + echo "In order to interact with Jira from the terminal you need to create an API token." + gum confirm "Open your browser to generate a Jira token?" && open https://id.atlassian.com/manage-profile/security/api-tokens + token=$(gum input --placeholder="Paste Jira token here" --password) + echo "JIRA_API_TOKEN='$token'" > ~/.config/.jira/token + task:restart + + fi + if [ ! -f ~/.config/.jira/mcmain.yml ]; then + docker:exec api "jira init --installation cloud --server https://enrise.atlassian.net --project MCMAIN --board 'MCMAIN board' --config ~/.config/.jira/mcmain.yml" + else + echo Jira set up correctly + fi +} + +function task:jira { ## Run jira commands + docker:exec api "jira --config ~/.config/.jira/mcmain.yml $*" +} + +function task:jira:status { ## Move the ticket to a status + ## Branch & open new MR + issue=$(git branch --show-current) + docker:exec api "jira --config ~/.config/.jira/mcmain.yml issue move $issue" + docker:exec api "jira --config ~/.config/.jira/mcmain.yml issue assign $issue" +} + +function task:jira:web { ## Open the ticket in your browser + ticket=$(git branch --show-current) + open https://enrise.atlassian.net/browse/$ticket +} + + # ========================================================= ## Automation # ========================================================= From 6773ccf981e6bcc288e4c7fa49e8859ade334693 Mon Sep 17 00:00:00 2001 From: Johan van Overbeeke Date: Sun, 3 Nov 2024 20:16:12 +0100 Subject: [PATCH 2/3] WIP convert to using default token --- Taskfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Taskfile b/Taskfile index 555149b..c0dc397 100755 --- a/Taskfile +++ b/Taskfile @@ -75,14 +75,16 @@ function task:production { ## Build and run production output } # Todo: Token als je meerdere Jira-omgevingen hebt +# TODO[Johan] Was er een reden dat we een project-specifiek token maakte? Zo nee, dan "default token gebruiken" afmaken function task:jira:init { title "Setting up Jira integration" - mkdir -p ~/.config/.jira - if [ ! -f ~/.config/.jira/token ]; then + # shellcheck disable=SC2046 + if [ ! $(jira me) ]; then echo "In order to interact with Jira from the terminal you need to create an API token." gum confirm "Open your browser to generate a Jira token?" && open https://id.atlassian.com/manage-profile/security/api-tokens token=$(gum input --placeholder="Paste Jira token here" --password) - echo "JIRA_API_TOKEN='$token'" > ~/.config/.jira/token + export JIRA_API_TOKEN="$token" + jira init task:restart fi From 0162e4ea3eb1c09fad47573f6a2e2c1f4b9c3878 Mon Sep 17 00:00:00 2001 From: Johan van Overbeeke Date: Sun, 3 Nov 2024 20:16:39 +0100 Subject: [PATCH 3/3] DO NOT MERGE: offsite backup of some TODO's / ideas --- TODO.txt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 TODO.txt diff --git a/TODO.txt b/TODO.txt new file mode 100644 index 0000000..8e8e58c --- /dev/null +++ b/TODO.txt @@ -0,0 +1,24 @@ +# TODO[Johan] lokale overrides mogelijk maken + +# TODO[Johan] sub-taskfiles: + - gespecialiseerde groepjes tasks die je normaal niet in detail in het hoofd file wil + - voorbeelden: git-hooks, ci commando's, project specifieke dingen als cache/queue/shopware-plugin manupilatie + - een task in het hoofd-file + - als je die aanroept, is dat effectief "help" in het subfile + - als je die aanroept met een task uit het subfile er achter, roep je de task uit het subfile aan + - dus: `./Taskfile git-hooks pre-commit` + - of: `./Taskfile ci start-fold` + +# TODO[Johan] aliassen voor tasks (ie: init en install :-P) + +# TODO[Johan] taskmaster bespreken: + - prima als default alias 'task' is + - ook in bovenliggende mapjes zoeken + - shell completion hierin stoppen + - self-updaten door file opnieuw te downloaden van url + - commandotje er in doen om gehele Taskfiles te genereren / nieuwe modules te downloaden? + +# TODO[Johan] Makefile convertor maken? + +# TODO[Johan] taskfile.sh claimen +