From d3cc4d6a154680e2ff1463ff2d1d3687fef82c1a Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 4 Nov 2024 13:24:46 -0600 Subject: [PATCH] more http options Signed-off-by: Jeff Carr --- Makefile | 36 ++++++++++++++++---------- http.go | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 97 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 5d52c4a..8d371ee 100644 --- a/Makefile +++ b/Makefile @@ -3,18 +3,16 @@ VERSION = $(shell git describe --tags) all: build ./guireleaser --help -single: build - ./guireleaser go.wit.com/apps/go-clone --increment --release --reason "testing guireleaser" --dry-run +# single: build +# ./guireleaser go.wit.com/apps/go-clone --increment --release --reason "testing guireleaser" --dry-run +# dump: +# ./guireleaser go.wit.com/apps/go-clone --increment --release --reason "testing guireleaser" --dry-run --dump-versions +# single-really-do-it: build +# ./guireleaser go.wit.com/apps/go-clone --increment --release --reason "testing guireleaser" -dump: - ./guireleaser go.wit.com/apps/go-clone --increment --release --reason "testing guireleaser" --dry-run --dump-versions - -single-really-do-it: build - ./guireleaser go.wit.com/apps/go-clone --increment --release --reason "testing guireleaser" - -stderr: build - echo "writing to /tmp/guireleaser.stderr" - ./guireleaser >/tmp/guireleaser.stderr 2>&1 +# stderr: build +# echo "writing to /tmp/guireleaser.stderr" +# ./guireleaser >/tmp/guireleaser.stderr 2>&1 goimports: goimports -w *.go @@ -51,8 +49,20 @@ curl-setBranchesToMasterB: curl-findNext: curl --silent http://localhost:9419/findNext +curl-showNext: + curl --silent http://localhost:9419/showNext + +curl-setTargetVersion: + curl --silent http://localhost:9419/setTargetVersion?version=v0.22.5 + +curl-IncrementMinorVersion: + curl --silent http://localhost:9419/IncrementMinorVersion?repo=go.wit.com/toolkit/debian + +curl-IncrementRevisonVersion: + curl --silent http://localhost:9419/IncrementRevisonVersion?repo=go.wit.com/toolkit/debian + # report on the release -curl-list-release: +curl-release-list: curl --silent http://localhost:9419/releaselist?readonly=true #curl-doSingleRepo: @@ -63,5 +73,5 @@ curl-list-changed: curl --silent http://localhost:9419/list?perfect=false # include repos that you probably can't git push commits -curl-list-include-readonly: +curl-everything-list: curl --silent http://localhost:9419/list?readonly=true diff --git a/http.go b/http.go index 8e356fb..633b171 100644 --- a/http.go +++ b/http.go @@ -64,10 +64,80 @@ func okHandler(w http.ResponseWriter, r *http.Request) { } else { msg(w, "findNext() did not find a repo. You might be finished?") } - msg(w, "repo: " + me.release.repo.String()) - msg(w, "name: " + me.release.version.String()) - msg(w, "notes: " + me.release.notes.String()) - msg(w, "status: " + me.release.status.String()) + msg(w, "repo: "+me.release.repo.String()) + msg(w, "name: "+me.release.version.String()) + msg(w, "notes: "+me.release.notes.String()) + msg(w, "status: "+me.release.status.String()) + + msg(w, me.current.StandardHeader()) + msg(w, me.current.StandardReleaseHeader()) + return + } + + if route == "/setCurrentRepo" { + repoName := r.URL.Query().Get("repo") + version := r.URL.Query().Get("version") + comment := r.URL.Query().Get("comment") + + msg(w, "repo: "+repoName) + msg(w, "version: "+version) + msg(w, "comment: "+comment) + + repo := me.repos.View.FindRepoByName(repoName) + if repo == nil { + msg(w, "FindRepoByName() returned nil") + return + } + + setCurrentRepo(repo, "HTTP", "doRelease() ?") + } + + if route == "/IncrementRevisonVersion" { + repo := r.URL.Query().Get("repo") + version := r.URL.Query().Get("version") + comment := r.URL.Query().Get("comment") + + msg(w, "repo: "+repo) + msg(w, "version: "+version) + + me.current.Status.IncrementRevisionVersion(comment) + return + } + + if route == "/IncrementMinorVersion" { + repo := r.URL.Query().Get("repo") + version := r.URL.Query().Get("version") + + msg(w, "repo: "+repo) + msg(w, "version: "+version) + + me.current.Status.IncrementMinorVersion("trying minor") + return + } + + if route == "/setTargetVersion" { + version := r.URL.Query().Get("version") + repo := r.URL.Query().Get("repo") + + msg(w, "repo: "+repo) + msg(w, "version: "+version) + me.current.Status.SetTargetVersion(version) + return + } + + if route == "/showNext" { + msg(w, "repo: "+me.release.repo.String()) + msg(w, "name: "+me.release.version.String()) + msg(w, "notes: "+me.release.notes.String()) + msg(w, "status: "+me.release.status.String()) + + if checkValidGoSum(me.current) { + msg(w, "checkValidGoSum() == true") + } else { + msg(w, "checkValidGoSum() == false") + } + msg(w, me.current.StandardHeader()) + msg(w, me.current.StandardReleaseHeader()) return }