@@ -220,8 +220,9 @@ type GitLab struct {
220
220
}
221
221
222
222
type BitBucket struct {
223
- BaseURL string `mapstructure:"baseUrl" json:"baseUrl"`
224
- Token string `mapstructure:"token" json:"token"`
223
+ BaseURL string `mapstructure:"baseUrl" json:"baseUrl"`
224
+ Token string `mapstructure:"token" json:"token"`
225
+ AllowCodeAccess bool `mapstructure:"allowCodeAccess" json:"allowCodeAccess"`
225
226
}
226
227
227
228
type AzureDevOps struct {
@@ -747,13 +748,48 @@ func LoadConfig(configFiles []string, deploymentId int) (*Config, error) {
747
748
Methods : ParseHttpMethods ([]string {"POST" }),
748
749
SetRequestHeaders : headers ,
749
750
},
751
+ // get and update PR comment
752
+ AllowlistItem {
753
+ URL : bitBucketBaseUrl .JoinPath ("/projects/:project/repos/:repo/pull-requests/:number/comments/:comment" ).String (),
754
+ Methods : ParseHttpMethods ([]string {"GET" , "PUT" }),
755
+ SetRequestHeaders : headers ,
756
+ },
750
757
// post blockerPR comment
751
758
AllowlistItem {
752
759
URL : bitBucketBaseUrl .JoinPath ("/projects/:project/repos/:repo/pull-requests/:number/blocker-comments" ).String (),
753
760
Methods : ParseHttpMethods ([]string {"POST" }),
754
761
SetRequestHeaders : headers ,
755
762
},
763
+ // namespace webhooks
764
+ AllowlistItem {
765
+ URL : bitBucketBaseUrl .JoinPath ("/projects/:project/webhooks" ).String (),
766
+ Methods : ParseHttpMethods ([]string {"GET" , "POST" }),
767
+ SetRequestHeaders : headers ,
768
+ },
769
+ AllowlistItem {
770
+ URL : bitBucketBaseUrl .JoinPath ("/projects/:project/webhooks/:webhook" ).String (),
771
+ Methods : ParseHttpMethods ([]string {"PUT" , "DELETE" }),
772
+ SetRequestHeaders : headers ,
773
+ },
756
774
)
775
+
776
+ if config .Inbound .BitBucket .AllowCodeAccess {
777
+ // get contents of file
778
+ config .Inbound .Allowlist = append (config .Inbound .Allowlist ,
779
+ AllowlistItem {
780
+ URL : bitBucketBaseUrl .JoinPath ("/projects/:project/repos/:repo/browse/:filepath" ).String (),
781
+ Methods : ParseHttpMethods ([]string {"GET" }),
782
+ SetRequestHeaders : headers ,
783
+ },
784
+ // update commit status
785
+ AllowlistItem {
786
+ URL : bitBucketBaseUrl .JoinPath ("/projects/:project/repos/:repo/commit/:commit/builds" ).String (),
787
+ Methods : ParseHttpMethods ([]string {"POST" }),
788
+ SetRequestHeaders : headers ,
789
+ },
790
+ )
791
+
792
+ }
757
793
}
758
794
759
795
if config .Inbound .AzureDevOps != nil {
0 commit comments