Skip to content

Commit

Permalink
Merge master into prod, release: v1.1.40
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorbenei committed Apr 5, 2018
2 parents d36e7ff + 5c627f0 commit 2eca2b9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
```

Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions bitriseapi/bitriseapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}

Expand Down Expand Up @@ -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)")
Expand Down
4 changes: 2 additions & 2 deletions service/hook/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package version

// VERSION ...
const VERSION = "1.1.39"
const VERSION = "1.1.40"

0 comments on commit 2eca2b9

Please sign in to comment.