Skip to content

webhooks cause multiple builds to happen, build loops #1735

Closed

Description

@thoraxe

Given the following template:

{
  "apiVersion": "v1beta1",
  "items": [
    {
      "apiVersion": "v1beta1",
      "containerPort": 8080,
      "id": "frontend",
      "kind": "Service",
      "port": 5432,
      "selector": {
        "name": "frontend"
      }
    },
    {
      "apiVersion": "v1beta1",
      "host": "wiring.cloudapps.example.com",
      "id": "sample-app-secure",
      "kind": "Route",
      "metadata": {
        "name": "route-edge"
      },
      "serviceName": "frontend"
    },
    {
      "apiVersion": "v1beta1",
      "kind": "ImageRepository",
      "metadata": {
        "name": "origin-ruby-sample"
      }
    },
    {
      "apiVersion": "v1beta1",
      "kind": "ImageRepository",
      "metadata": {
        "name": "ruby-20-centos7"
      }
    },
    {
      "apiVersion": "v1beta1",
      "kind": "BuildConfig",
      "labels": {
        "name": "ruby-sample-build"
      },
      "metadata": {
        "name": "ruby-sample-build"
      },
      "parameters": {
        "output": {
          "to": {
            "name": "origin-ruby-sample"
          }
        },
        "source": {
          "git": {
            "uri": "git://github.com/openshift/ruby-hello-world.git",
            "ref": "beta2"
          },
          "type": "Git"
        },
        "strategy": {
          "stiStrategy": {
            "image": "openshift/ruby-20-centos7"
          },
          "type": "STI"
        }
      },
      "triggers": [
        {
          "github": {
            "secret": "secret101"
          },
          "type": "github"
        },
        {
          "generic": {
            "secret": "secret101"
          },
          "type": "generic"
        },
        {
          "imageChange": {
            "from": {
              "name": "ruby-20-centos7"
            },
            "image": "openshift/ruby-20-centos7",
            "tag": "latest"
          },
          "type": "imageChange"
        }
      ]
    },
    {
      "apiVersion": "v1beta1",
      "kind": "DeploymentConfig",
      "metadata": {
        "name": "frontend"
      },
      "template": {
        "controllerTemplate": {
          "podTemplate": {
            "desiredState": {
              "manifest": {
                "containers": [
                  {
                    "env": [
                      {
                        "name": "ADMIN_USERNAME",
                        "value": "${ADMIN_USERNAME}"
                      },
                      {
                        "name": "ADMIN_PASSWORD",
                        "value": "${ADMIN_PASSWORD}"
                      },
                      {
                        "name": "MYSQL_ROOT_PASSWORD",
                        "value": "${MYSQL_ROOT_PASSWORD}"
                      },
                      {
                        "name": "MYSQL_DATABASE",
                        "value": "${MYSQL_DATABASE}"
                      }
                    ],
                    "image": "origin-ruby-sample",
                    "name": "ruby-helloworld",
                    "ports": [
                      {
                        "containerPort": 8080
                      }
                    ]
                  }
                ],
                "version": "v1beta1"
              }
            },
            "labels": {
              "name": "frontend"
            }
          },
          "replicaSelector": {
            "name": "frontend"
          },
          "replicas": 1
        },
        "strategy": {
          "type": "Recreate"
        }
      },
      "triggers": [
        {
          "imageChangeParams": {
            "automatic": true,
            "containerNames": [
              "ruby-helloworld"
            ],
            "from": {
              "name": "origin-ruby-sample"
            },
            "tag": "latest"
          },
          "type": "ImageChange"
        }
      ]
    }
  ],
  "kind": "Template",
  "metadata": {
    "annotations": {
      "description": "This frontend template will be used to demonstrate parameters"
    },
    "name": "frontend-app-template"
  },
  "parameters": [
    {
      "description": "administrator username",
      "from": "admin[A-Z0-9]{3}",
      "generate": "expression",
      "name": "ADMIN_USERNAME"
    },
    {
      "description": "administrator password",
      "from": "[a-zA-Z0-9]{8}",
      "generate": "expression",
      "name": "ADMIN_PASSWORD"
    },
    {
      "description": "database password",
      "from": "[a-zA-Z0-9]{8}",
      "generate": "expression",
      "name": "MYSQL_ROOT_PASSWORD"
    },
    {
      "description": "database name",
      "name": "MYSQL_DATABASE",
      "value": "root"
    }
  ],
  "labels": {
    "template": "application-template-stibuild"
  }
}

When initially processed and created, a single build happens. That's fine. (-1)

If you then start a new build via curl/webhook, you immediately get 2 builds. (-2, -3)

When those 2 builds finish, then you get one more build (-4) before everything finally stops.

If you issue a curl again, the same thing happens:

2 builds immediately (-5, -6)
1 more build after (-7)

NAME                  TYPE      STATUS     POD
ruby-sample-build-1   STI       Complete   ruby-sample-build-1
ruby-sample-build-2   STI       Complete   ruby-sample-build-2
ruby-sample-build-3   STI       Complete   ruby-sample-build-3
ruby-sample-build-4   STI       Complete   ruby-sample-build-4
ruby-sample-build-5   STI       Complete   ruby-sample-build-5
ruby-sample-build-6   STI       Complete   ruby-sample-build-6
ruby-sample-build-7   STI       Complete   ruby-sample-build-7
ruby-sample-build-8   STI       Complete   ruby-sample-build-8
ruby-sample-build-9   STI       Running    ruby-sample-build-9

It also appears that builds kept running after the fact, because while writing this issue I got up to 9 builds.

osc v0.4.3.2
kubernetes v0.14.1-582-gb12d75d

Activity

  1. bparees commented on Apr 14, 2015

    @bparees
    Contributor

    does osc start-build result in the same behavior as invoking the webhook?

  2. thoraxe commented on Apr 14, 2015

    @thoraxe
    ContributorAuthor

    "start-build" does not give me two builds. I am waiting to see if the loop starts.

  3. thoraxe commented on Apr 14, 2015

    @thoraxe
    ContributorAuthor

    I can't seem to reproduce so I will close this unless I see it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions