diff --git a/README.md b/README.md index a87918c0..01f8bc56 100644 --- a/README.md +++ b/README.md @@ -264,7 +264,7 @@ curl -X POST --data 'just a text body' -H 'Example-Header: example header value' by default the server will print what and where it would send (debug mode), so you should see this in the server's log: ``` -2017/09/10 16:30:18 ===> Triggering Build: (url:https://www.bitrise.io/app/BITRISE-APP-SLUG/build/start.json) +2017/09/10 16:30:18 ===> Triggering Build: (url:https://app.bitrise.io/app/BITRISE-APP-SLUG/build/start.json) 2017/09/10 16:30:18 ====> JSON body: {"build_params":{"branch":"master","environments":[{"mapped_to":"BITRISE_WEBHOOK_PASSTHROUGH_HEADERS","value":"{\"Accept\":[\"*/*\"],\"Accept-Encoding\":[\"gzip\"],\"Content-Length\":[\"16\"],\"Content-Type\":[\"application/x-www-form-urlencoded\"],\"Example-Header\":[\"example header value\"],\"User-Agent\":[\"curl/7.54.0\"],\"X-Forwarded-For\":[\"::1\"]}","is_expand":false},{"mapped_to":"BITRISE_WEBHOOK_PASSTHROUGH_BODY","value":"just a text body","is_expand":false}]},"triggered_by":"webhook"} ``` @@ -404,6 +404,9 @@ provider implementation. * Once your transform functions are well tested you should get back to the `TransformRequest` function, test & implement that too * You should include a sample webhook data & test, as you can see it in the `github` and `bitbucketv2` services. +* Run the tests & linters with: `bitrise run test` + * To run only the Go tests: `go test ./...` + * To run only the tests of your own package (`github` in this example): `go test ./service/hook/github/...` * Once the implementation is ready you can register a path/route for the service/provider: * Open `service/hook/endpoint.go` * Add your provider to the `supportedProviders` map diff --git a/bitriseapi/bitriseapi_test.go b/bitriseapi/bitriseapi_test.go index de133f1e..7ab20293 100644 --- a/bitriseapi/bitriseapi_test.go +++ b/bitriseapi/bitriseapi_test.go @@ -9,16 +9,16 @@ import ( func TestBuildTriggerURL(t *testing.T) { t.Log("Endpoint URL doesn't end with /") { - url, err := BuildTriggerURL("https://www.bitrise.io", "a..............b") + url, err := BuildTriggerURL("https://app.bitrise.io", "a..............b") require.NoError(t, err) - require.Equal(t, "https://www.bitrise.io/app/a..............b/build/start.json", url.String()) + require.Equal(t, "https://app.bitrise.io/app/a..............b/build/start.json", url.String()) } t.Log("Endpoint URL ends with /") { - url, err := BuildTriggerURL("https://www.bitrise.io/", "a..............b") + url, err := BuildTriggerURL("https://app.bitrise.io/", "a..............b") require.NoError(t, err) - require.Equal(t, "https://www.bitrise.io/app/a..............b/build/start.json", url.String()) + require.Equal(t, "https://app.bitrise.io/app/a..............b/build/start.json", url.String()) } } @@ -71,7 +71,7 @@ func Test_TriggerAPIParamsModel_Validate(t *testing.T) { } func TestTriggerBuild(t *testing.T) { - url, err := BuildTriggerURL("https://www.bitrise.io", "app-slug") + url, err := BuildTriggerURL("https://app.bitrise.io", "app-slug") require.NoError(t, err) t.Log("Empty trigger api params (invalid)") diff --git a/service/hook/endpoint.go b/service/hook/endpoint.go index 532de6fd..7cd28cb2 100644 --- a/service/hook/endpoint.go +++ b/service/hook/endpoint.go @@ -11,6 +11,7 @@ import ( "github.com/bitrise-io/bitrise-webhooks/metrics" "github.com/bitrise-io/bitrise-webhooks/service" "github.com/bitrise-io/bitrise-webhooks/service/hook/assembla" + "github.com/bitrise-io/bitrise-webhooks/service/hook/bitbucketserver" "github.com/bitrise-io/bitrise-webhooks/service/hook/bitbucketv2" hookCommon "github.com/bitrise-io/bitrise-webhooks/service/hook/common" "github.com/bitrise-io/bitrise-webhooks/service/hook/deveo" @@ -23,7 +24,6 @@ import ( "github.com/bitrise-io/go-utils/colorstring" "github.com/gorilla/mux" "github.com/pkg/errors" - "github.com/bitrise-io/bitrise-webhooks/service/hook/bitbucketserver" ) func supportedProviders() map[string]hookCommon.Provider { @@ -169,7 +169,7 @@ func HTTPHandler(w http.ResponseWriter, r *http.Request) { // Let's Trigger a build / some builds! triggerURL := config.SendRequestToURL if triggerURL == nil { - u, err := bitriseapi.BuildTriggerURL("https://www.bitrise.io", appSlug) + u, err := bitriseapi.BuildTriggerURL("https://app.bitrise.io", appSlug) if err != nil { log.Printf(" [!] Exception: hookHandler: failed to create Build Trigger URL: %s", err) respondWithErrorString(w, &hookProvider, fmt.Sprintf("Failed to create Build Trigger URL: %s", err)) diff --git a/version/version.go b/version/version.go index be356d8a..fa05de85 100644 --- a/version/version.go +++ b/version/version.go @@ -1,4 +1,4 @@ package version // VERSION ... -const VERSION = "1.1.39" +const VERSION = "1.1.40"