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

[CI]: CI pipeline #54

Merged
merged 12 commits into from
Jun 24, 2020
Merged

[CI]: CI pipeline #54

merged 12 commits into from
Jun 24, 2020

Conversation

v1v
Copy link
Member

@v1v v1v commented Jun 12, 2020

What

Enable CI pipeline to build and push the docker images.

The push event works for:

Tasks

Test

  • REPOSITORY=docker.elastic.co/observability-ci make build
$ docker images | grep observability-ci            
docker.elastic.co/observability-ci/fpm                      1.11.0                 1fbf2b9b5555        2 minutes ago       416MB
docker.elastic.co/observability-ci/golang-crossbuild        1.14.4-main-debian8    51fbb901cd8a        2 minutes ago       1.39GB
docker.elastic.co/observability-ci/golang-crossbuild        1.14.4-main-debian7    3c5321b6f233        2 minutes ago       1.01GB
docker.elastic.co/observability-ci/golang-crossbuild        1.14.4-s390x           8064f3af14bd        2 minutes ago       807MB
docker.elastic.co/observability-ci/golang-crossbuild        1.14.4-ppc             57b58c057ff9        2 minutes ago       994MB
...
  • REPOSITORY=docker.elastic.co/observability-ci make push
echo ">> Pushing docker.elastic.co/observability-ci/golang-crossbuild:1.10.8-base"
>> Pushing docker.elastic.co/observability-ci/golang-crossbuild:1.10.8-base
The push refers to repository [docker.elastic.co/observability-ci/golang-crossbuild]
772921e6e3a7: Preparing 
041e855fb031: Preparing 
e142d45a5747: Preparing 
...

@v1v v1v marked this pull request as ready for review June 12, 2020 16:18
@v1v
Copy link
Member Author

v1v commented Jun 15, 2020

I need your review:

I'm afraid I'm not an admin of this particular repo therefore I cannot assign reviewers.

Jenkinsfile Outdated Show resolved Hide resolved
Jenkinsfile Outdated Show resolved Hide resolved
Co-authored-by: cachedout <mike.place@elastic.co>
@@ -1,4 +1,4 @@
REPOSITORY := docker.elastic.co/beats-dev
REPOSITORY ?= docker.elastic.co/beats-dev
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the only change in the code to be able to set the repository where the docker images can be pushed, by default as used to be, but as we will be using the staging stage, then this will help to generate docker images on a PR basis which can be consumed for testing purposes.

Copy link
Contributor

@mikemadden42 mikemadden42 left a comment

Choose a reason for hiding this comment

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

LGTM

@andrewkroh
Copy link
Member

I'm afraid I'm not an admin of this particular repo therefore I cannot assign reviewers.

This repo is tied in with membership in https://github.com/orgs/elastic/teams/beats-contributors if you want to join.

@andrewkroh
Copy link
Member

on tag based to the default location set in the Makefile.

This implies that this repo will need to start doing some tagging. As of now we've been pushing new images whenever master changed. And we really only changed master when new Go releases were available. I'm not against requiring tagging, but we should have a plan for it if we go this route (when do we tag, what do the tags mean, how do we convey the tag in the image metadata).

@v1v
Copy link
Member Author

v1v commented Jun 16, 2020

@andrewkroh , thanks for the details, I'm not really familiar with the release process for this project, I was just thinking the tag could be matching the go version, but there are certain questions as you stated that they are required to be addressed beforehand.

What do we do from here?

@kuisathaverat
Copy link
Contributor

kuisathaverat commented Jun 16, 2020

as Victor said, the most logical tag is the Go version. Using tags adds the possibility to compile with any images generated for a previous Go version in case we need it for some test, or we want to compile with several Go versions at some point.

@andrewkroh
Copy link
Member

To be clear I was talking about git tagging, which is what I assume is meant in "on tag based to the default location". Any build of the repo produces images for multiple Go versions. Those images have docker tags containing the Go version and the cross-compiler architecture (see build tags).

Perhaps the path forward is to not introduce git tagging into the image push process at this time. And setup the job to push changes from master to the default location in the Makefile.

I think we can get the same ability to reproduce old builds if we add an additional docker tag (without git tags) that contains a time component (e.g. 1.10.8-main-20191124). Then if I need to exactly reproduce some old Beats build for whatever reason, we can use the time tagged docker images from the time of the original build. The images already contain docker labels following http://label-schema.org/rc1/ that contain this repo's commit ID in case we need to know the exact Dockerfiles that went into producing the images.

If we do want to use git tags to trigger the image pushes then we should

  • push an additional docker tag that incorporates the git tag (e.g. push both 1.14.1-main-debian7 and 1.14.1-main-debian7-vXX)
  • add the git tag to the image labels (org.label-schema.version = $git_tag)

@v1v
Copy link
Member Author

v1v commented Jun 16, 2020

To keep it simple, I'll remove the on tag based event to be master based. Then we can start a conversation in another thread to discuss how the release process looks like and what are the things, if any, that we could change.

v1v added 2 commits June 16, 2020 15:10
…ature/ci

* 'feature/ci' of github.com:v1v/golang-crossbuild:
  Apply suggestions from code review
@v1v
Copy link
Member Author

v1v commented Jun 16, 2020

c5cc234 is now the new behaviour.

NOTE: if we merge this particular PR then the automation to push those docker images will happen immediately.

@v1v
Copy link
Member Author

v1v commented Jun 16, 2020

I'll merge this particular PR as soon as the github setup is in place (webhooks and permissions)

@v1v v1v self-assigned this Jun 18, 2020
@elasticmachine
Copy link

elasticmachine commented Jun 18, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #54 updated]

  • Start Time: 2020-06-23T11:19:26.454+0000

  • Duration: 84 min 57 sec

@v1v v1v marked this pull request as draft June 18, 2020 10:29
@v1v
Copy link
Member Author

v1v commented Jun 18, 2020

Alright, we got all the required webhooks and service accounts in place to run in the CI!

As soon as the build gets green then I'll merge it

@v1v v1v marked this pull request as ready for review June 18, 2020 11:01
@v1v
Copy link
Member Author

v1v commented Jun 23, 2020

For the record ead3be2 removed the issues with the push.* which it's not required anymore at all (for furtherh details please refers to the infra docs).

Already tested locally:

$ docker tag docker.elastic.co/observability-ci/fpm:1.11.0 docker.elastic.co/observability-ci/fpm:test                                                                       
$ docker push docker.elastic.co/observability-ci/fpm:test                                                                   
The push refers to repository [docker.elastic.co/observability-ci/fpm]
aa5033bd89aa: Pushed 
dc29c4af552e: Pushed 
0f7b4d7b24a5: Pushed 
7deb88e599ba: Pushed 
8354d5896557: Mounted from observability-ci/golang-crossbuild 
test: digest: sha256:1c8721bf3d8095878b02855a8c3d90a6c6d380de49c2483929e68323df487687 size: 1368

@v1v v1v merged commit 4dda323 into elastic:master Jun 24, 2020
@v1v v1v deleted the feature/ci branch June 24, 2020 07:09
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.

7 participants