@@ -77,21 +77,28 @@ type BuildConfigData struct {
7777// buildConfig represents the relevant fields of an OpenShift BuildConfig, see
7878// https://docs.openshift.com/container-platform/3.11/rest_api/apis-build.openshift.io/v1.BuildConfig.html#object-schema.
7979type buildConfig struct {
80- Metadata struct {
81- ResourceVersion string `json:"resourceVersion"`
82- } `json:"metadata"`
83- Spec struct {
84- Source struct {
85- Git struct {
86- Ref string `json:"ref"`
87- } `json:"git"`
88- } `json:"source"`
89- Strategy struct {
90- JenkinsPipelineStrategy struct {
91- JenkinsfilePath string `json:"jenkinsfilePath"`
92- } `json:"jenkinsPipelineStrategy"`
93- } `json:"strategy"`
94- } `json:"spec"`
80+ Metadata struct {
81+ ResourceVersion string `json:"resourceVersion"`
82+ } `json:"metadata"`
83+ Spec struct {
84+ Source struct {
85+ Git struct {
86+ Ref string `json:"ref"`
87+ } `json:"git"`
88+ } `json:"source"`
89+ Strategy struct {
90+ JenkinsPipelineStrategy struct {
91+ JenkinsfilePath string `json:"jenkinsfilePath"`
92+ } `json:"jenkinsPipelineStrategy"`
93+ } `json:"strategy"`
94+ Triggers []struct {
95+ Type string `json:"type"`
96+ // Generic struct {
97+ // Secret string `json:"secret"`
98+ // AllowEnv bool `json:"allowEnv"`
99+ // } `json:"generic"`
100+ } `json:"triggers"`
101+ } `json:"spec"`
95102}
96103
97104// Client makes requests, e.g. to create and delete pipelines, or to forward
@@ -509,6 +516,18 @@ func (s *Server) HandleRoot() http.HandlerFunc {
509516 updatePipeline = true
510517 resourceVersion = bc .Metadata .ResourceVersion
511518 }
519+ triggerExists := false
520+ for _ , trigger := range bc .Spec .Triggers {
521+ if trigger .Type != "" {
522+ triggerExists = true
523+ break
524+ }
525+ }
526+ if ! triggerExists {
527+ log .Println (requestID , "Trigger secret does not exist, updating pipeline" )
528+ updatePipeline = true
529+ resourceVersion = bc .Metadata .ResourceVersion
530+ }
512531 }
513532
514533 buildConfigData := BuildConfigData {
0 commit comments