Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert builder images to go #347

Merged
merged 1 commit into from
Nov 7, 2014

Conversation

csrwng
Copy link
Contributor

@csrwng csrwng commented Nov 5, 2014

Builder images converted to go commands. Main builder code in pkg/build/builder

}

// dockerBuild performs a docker build on the source that has been retrieved
func (d *DockerBuilder) dockerBuild() (err error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general when you have single return values, don't use named parameters. Named return values should be used judiciously.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@csrwng csrwng force-pushed the go_build_scripts_2 branch 2 times, most recently from e13a2f7 to b9a7659 Compare November 6, 2014 00:44
@csrwng
Copy link
Contributor Author

csrwng commented Nov 6, 2014

@smarterclayton - who do we need to sign off on this one to get it merged?

@smarterclayton
Copy link
Contributor

I'm in the process of reviewing now


// DockerBuilder builds Docker images given a git repository URL
type DockerBuilder struct {
*builder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally embedding a pointer to a struct for anything except trivial wrapping is frowned on. Why can't this be an interface, and why does it have to be nested like this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pattern was to share common code between DockerBuilder and STIBuilder, but I'll extract it out into its own interface.

@soltysh
Copy link
Contributor

soltysh commented Nov 6, 2014

@csrwng be sure to check #143 for ideas regarding this transition.

@csrwng
Copy link
Contributor Author

csrwng commented Nov 6, 2014

@soltysh thx, I think that's what we are doing now.

@csrwng
Copy link
Contributor Author

csrwng commented Nov 6, 2014

@smarterclayton - I've pushed a new commit to address your concerns

@csrwng csrwng force-pushed the go_build_scripts_2 branch 2 times, most recently from 042f9c1 to e9c044c Compare November 6, 2014 16:14
@csrwng
Copy link
Contributor Author

csrwng commented Nov 6, 2014

Made additional fixes suggested by @mfojtik

if _, err = builder.Build(); err != nil {
return err
}
if s.build.Parameters.Output.Registry != "" || s.authPresent {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't I push to the docker hub?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you can, only if an auth entry is present. Otherwise, we'll try to push only if you've specified a registry.

@smarterclayton
Copy link
Contributor

LGTM [merge], may have some follow up comments

@openshift-bot
Copy link
Contributor

Origin Merge Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_openshift3/338/) (Image: devenv-fedora_353)

@openshift-bot
Copy link
Contributor

[Test]ing while waiting on the merge queue

@openshift-bot
Copy link
Contributor

@csrwng
Copy link
Contributor Author

csrwng commented Nov 7, 2014

[test]

@smarterclayton
Copy link
Contributor

What was the failure? Flakiness?

@csrwng
Copy link
Contributor Author

csrwng commented Nov 7, 2014

It got further this time, still taking a look... the earlier failure was definitely flakiness, but this one might be a real issue.

@csrwng
Copy link
Contributor Author

csrwng commented Nov 7, 2014

Yup, so the problem now is that we take the commit id from the webhook seriously (meaning we try to build that commit id) and the one in the end-to-end test is fake. Therefore the build fails. For this PR I'll just make that commit id blank.

1 similar comment
@csrwng
Copy link
Contributor Author

csrwng commented Nov 7, 2014

Yup, so the problem now is that we take the commit id from the webhook seriously (meaning we try to build that commit id) and the one in the end-to-end test is fake. Therefore the build fails. For this PR I'll just make that commit id blank.

@csrwng
Copy link
Contributor Author

csrwng commented Nov 7, 2014

Updated the example github webhook json and separated the tag from the repository in the push image call. However, there still seems to be an issue with pushing the image:

Image successfully pushed
Pushing
2014/11/07 02:16:29 Build error: Failed to upload metadata: Put http://172.121.17.1:5001/v1/images/fbdd2eaadf3a1d9d8272bb57b7b990f0e54d2645b0a5498ecc5185121b14000f/json: read tcp 172.121.17.1:5001: connection reset by peer

Testing again [test]

@csrwng
Copy link
Contributor Author

csrwng commented Nov 7, 2014

So it looks like the registry only remains up for about 4 mins. At that point it dies and a new one is launched. If I run the e2e tests locally, everything works. But on the Jenkins box, it seems that the 4 min is not enough for the build to push the resulting image.

@csrwng
Copy link
Contributor Author

csrwng commented Nov 7, 2014

The reason the registry keeps relaunching is because a new deployment is getting triggered periodically. The reason for the deployment is 'ConfigChange'. However the config doesn't seem to change from one deployment to the next. This is one of the deployments:

{
    "apiVersion": "v1beta1",
    "controllerTemplate": {
        "podTemplate": {
            "desiredState": {
                "manifest": {
                    "containers": [
                        {
                            "env": [
                                {
                                    "key": "STORAGE_PATH",
                                    "name": "STORAGE_PATH",
                                    "value": "/tmp/openshift.local.registry"
                                },
                                {
                                    "key": "OPENSHIFT_URL",
                                    "name": "OPENSHIFT_URL",
                                    "value": "http://172.17.42.1:8080/osapi/v1beta1"
                                },
                                {
                                    "key": "REGISTRY_URL",
                                    "name": "REGISTRY_URL",
                                    "value": "172.121.17.1:5001"
                                }
                            ],
                            "image": "registry",
                            "imagePullPolicy": "",
                            "name": "registry-container",
                            "ports": [
                                {
                                    "containerPort": 5000,
                                    "protocol": "TCP"
                                }
                            ],
                            "volumeMounts": [
                                {
                                    "mountPath": "/tmp/openshift.local.registry",
                                    "name": "registry-storage",
                                    "path": "/tmp/openshift.local.registry"
                                }
                            ]
                        }
                    ],
                    "id": "",
                    "restartPolicy": {
                        "always": {}
                    },
                    "version": "v1beta1",
                    "volumes": [
                        {
                            "name": "registry-storage",
                            "source": {
                                "emptyDir": null,
                                "hostDir": {
                                    "path": "/tmp/openshift.local.registry"
                                },
                                "persistentDisk": null
                            }
                        }
                    ]
                }
            },
            "labels": {
                "deployment": "docker-registry-3",
                "deploymentConfig": "docker-registry",
                "name": "registrypod"
            }
        },
        "replicaSelector": {
            "name": "registrypod"
        },
        "replicas": 1
    },
    "creationTimestamp": "2014-11-07T04:06:45Z",
    "details": {
        "causes": [
            {
                "type": "ConfigChange"
            }
        ]
    },
    "id": "docker-registry-3",
    "kind": "Deployment",
    "labels": {
        "deploymentConfig": "docker-registry"
    },
    "namespace": "test",
    "resourceVersion": 62,
    "selfLink": "/osapi/v1beta1/deployments/docker-registry-3",
    "status": "Complete",
    "strategy": {
        "type": "Basic"
    }
}

@csrwng
Copy link
Contributor Author

csrwng commented Nov 7, 2014

Submitted a fix for the unnecessary deployments here: #366

@csrwng
Copy link
Contributor Author

csrwng commented Nov 7, 2014

Rebased. [test]

@openshift-bot
Copy link
Contributor

Evaluated for origin up to 8da7af8

openshift-bot pushed a commit that referenced this pull request Nov 7, 2014
@openshift-bot openshift-bot merged commit ddcf9ef into openshift:master Nov 7, 2014
@smarterclayton smarterclayton mentioned this pull request Nov 12, 2014
@csrwng csrwng deleted the go_build_scripts_2 branch February 5, 2015 13:17
miminar pushed a commit to miminar/origin that referenced this pull request Oct 26, 2016
jpeeler pushed a commit to jpeeler/origin that referenced this pull request Feb 1, 2018
generate informers with upstream informer-gen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants