Skip to content

Use build template #20

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

Merged
merged 1 commit into from
Oct 31, 2016
Merged

Use build template #20

merged 1 commit into from
Oct 31, 2016

Conversation

thockin
Copy link
Member

@thockin thockin commented Oct 28, 2016

Faster builds and versions from tags. Also use alpine as a base image. We need alpine for other architectures...

Fixes #10


This change is Reviewable

@thockin
Copy link
Member Author

thockin commented Oct 28, 2016

This builds on #19, so we should merge that first

@thockin
Copy link
Member Author

thockin commented Oct 28, 2016

I forgot about the issue in #10 - will have to think about it.

DO NOT MERGE

@thockin
Copy link
Member Author

thockin commented Oct 28, 2016

I think I can just install coreutils. Building now.

@stp-ip
Copy link
Member

stp-ip commented Oct 28, 2016

For me tests fail as the git-sync location isn't changed within the test_e2e.sh.
Should move from /bin/git-sync-amd64 to /bin/amd64/git-sync

@thockin thockin force-pushed the use-build-template branch from cd1026d to 836e10b Compare October 28, 2016 16:15
@thockin
Copy link
Member Author

thockin commented Oct 28, 2016

Fixed. I'll also update the test to run the docker image.

On Fri, Oct 28, 2016 at 9:14 AM, Michael Grosser notifications@github.com
wrote:

For me tests fail as the git-sync location isn't changed within the
test_e2e.sh.
Should move from /bin/git-sync-amd64 to /bin/amd/git-sync


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#20 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFVgVNb9z-uxys6t3gP4N_qBi6_BCqrWks5q4h9IgaJpZM4Kjlwm
.

ifeq ($(ARCH),amd64)
docker tag $(IMAGE):$(TAG) $(LEGACY_AMD64_IMAGE):$(TAG)
BASEIMAGE?=alpine
Copy link
Member

Choose a reason for hiding this comment

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

Should we really not version alpine here? Probably better to be explicit with

    BASEIMAGE?=alpine:3.4

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@stp-ip
Copy link
Member

stp-ip commented Oct 28, 2016

Yeah coreutils would fix #10, but add ~6mb. Probably worth it considering shaving off almost 100 due to moving to alpine.
Awesome work.

@thockin thockin force-pushed the use-build-template branch 2 times, most recently from a501a68 to 35c89d4 Compare October 28, 2016 16:33
@thockin
Copy link
Member Author

thockin commented Oct 28, 2016

Test runs the docker image now. PTAL

-v $$(pwd)/.go:/go \
-v $$(pwd):/go/src/$(PKG) \
-v $$(pwd)/bin/$(ARCH):/go/bin \
-v $$(pwd)/bin/$(ARCH):/go/bin/linux_$(ARCH) \
Copy link
Member

Choose a reason for hiding this comment

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

This line seems unnecessary.

@thockin
Copy link
Member Author

thockin commented Oct 28, 2016

It is needed when building other architectures. I have a template Makefile
that this derives from, which is used in a bunch of other kube repos and
subdirs :)

On Fri, Oct 28, 2016 at 9:44 AM, Michael Grosser notifications@github.com
wrote:

@stp-ip requested changes on this pull request.

In Makefile
#20 (review)
:

+all-container: $(addprefix container-, $(ALL_ARCH))
+
+all-push: $(addprefix push-, $(ALL_ARCH))
+
+build: bin/$(ARCH)/$(BIN)
+
+bin/$(ARCH)/$(BIN): build-dirs

  • @echo "building: $@"
  • @docker run \
  • -ti                                                                \
    
  • -u $$(id -u):$$(id -g)                                             \
    
  • -v $$(pwd)/.go:/go                                                 \
    
  • -v $$(pwd):/go/src/$(PKG)                                          \
    
  • -v $$(pwd)/bin/$(ARCH):/go/bin                                     \
    
  • -v $$(pwd)/bin/$(ARCH):/go/bin/linux_$(ARCH)                       \
    

This line seems unnecessary.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#20 (review),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFVgVIk99Rmpq88j_EoO4oHTsjOUJGQ-ks5q4iZ1gaJpZM4Kjlwm
.

@docker build -t $(IMAGE):$(VERSION) -f .dockerfile-$(ARCH) .
@docker images -q $(IMAGE):$(VERSION) > $@
@if [ "$(ARCH)" == "amd64" ]; then \
docker tag -f $(IMAGE):$(VERSION) $(LEGACY_IMAGE):$(VERSION); \
Copy link
Member

Choose a reason for hiding this comment

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

-f is deprecated and actually removed in docker 1.12. Just remove it for builds with docker 1.10+

@thockin
Copy link
Member Author

thockin commented Oct 28, 2016

my desktop is still 1.9 - I'll have to upgrade :)

On Fri, Oct 28, 2016 at 10:07 AM, Michael Grosser notifications@github.com
wrote:

@stp-ip commented on this pull request.

In Makefile
#20 (review)
:

  •       ./build/build.sh                                               \
    
  • "
    
    +DOTFILE_IMAGE = $(subst /,_,$(IMAGE))-$(VERSION)
    +
    +container: .container-$(DOTFILE_IMAGE) container-name
    +.container-$(DOTFILE_IMAGE): bin/$(ARCH)/$(BIN) Dockerfile.in
  • @Sed \
  • -e 's|ARG_BIN|$(BIN)|g' \
    
  • -e 's|ARG_ARCH|$(ARCH)|g' \
    
  • -e 's|ARG_FROM|$(BASEIMAGE)|g' \
    
  • Dockerfile.in > .dockerfile-$(ARCH)
    
  • @docker build -t $(IMAGE):$(VERSION) -f .dockerfile-$(ARCH) .
  • @docker images -q $(IMAGE):$(VERSION) > $@
  • @if [ "$(ARCH)" == "amd64" ]; then \
  • docker tag -f $(IMAGE):$(VERSION) $(LEGACY_IMAGE):$(VERSION); \
    

-f is deprecated and actually removed in docker 1.12. Just remove it for
builds with docker 1.10+


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#20 (review),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFVgVKDjBTf38v1D0wDJsdAsIRlNobycks5q4ivNgaJpZM4Kjlwm
.

@thockin
Copy link
Member Author

thockin commented Oct 28, 2016

hmm, no upgrade available from corp...

On Fri, Oct 28, 2016 at 10:09 AM, Tim Hockin thockin@google.com wrote:

my desktop is still 1.9 - I'll have to upgrade :)

On Fri, Oct 28, 2016 at 10:07 AM, Michael Grosser <
notifications@github.com> wrote:

@stp-ip commented on this pull request.

In Makefile
#20 (review)
:

  •      ./build/build.sh                                               \
    
  •    "
    
    +DOTFILE_IMAGE = $(subst /,_,$(IMAGE))-$(VERSION)
    +
    +container: .container-$(DOTFILE_IMAGE) container-name
    +.container-$(DOTFILE_IMAGE): bin/$(ARCH)/$(BIN) Dockerfile.in
  • @Sed \
  •    -e 's|ARG_BIN|$(BIN)|g' \
    
  •    -e 's|ARG_ARCH|$(ARCH)|g' \
    
  •    -e 's|ARG_FROM|$(BASEIMAGE)|g' \
    
  •    Dockerfile.in > .dockerfile-$(ARCH)
    
  • @docker build -t $(IMAGE):$(VERSION) -f .dockerfile-$(ARCH) .
  • @docker images -q $(IMAGE):$(VERSION) > $@
  • @if [ "$(ARCH)" == "amd64" ]; then \
  •    docker tag -f $(IMAGE):$(VERSION) $(LEGACY_IMAGE):$(VERSION); \
    

-f is deprecated and actually removed in docker 1.12. Just remove it for
builds with docker 1.10+


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#20 (review),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFVgVKDjBTf38v1D0wDJsdAsIRlNobycks5q4ivNgaJpZM4Kjlwm
.

@@ -49,8 +49,15 @@ function assert_file_eq() {

# Build it
echo "Building..."
make >/dev/null
GIT_SYNC=./bin/git-sync-amd64
make container REGISTRY=e2e TAG=$(make version) >/dev/null
Copy link
Member

Choose a reason for hiding this comment

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

For me the $(make version) is not silenced and therefore is assigned "Entering".
Would use $(make -s version) instead.

-i \
-u $(id -u):$(id -g) \
-v "$DIR":"$DIR" \
e2e/git-sync-amd64:$(make version) \
Copy link
Member

Choose a reason for hiding this comment

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

Same here. Would use $(make -s version) instead.

Faster builds and versions from tags.  Also use alpine as a base image.  We
need alpine for other architectures...

Also change the --wait flag to take a float for sub-second waits.
@thockin thockin force-pushed the use-build-template branch from 35c89d4 to 70feeb5 Compare October 31, 2016 00:09
@thockin
Copy link
Member Author

thockin commented Oct 31, 2016

Fixed in new push, passes e2e.

@stp-ip stp-ip merged commit 7fdc748 into kubernetes:master Oct 31, 2016
@TaiSHiNet
Copy link

Awesome!! Please let me know when you push this to grc, I'll grab the tag (tried v2.0.3 already and nope)
Thanks for your work!

@stp-ip
Copy link
Member

stp-ip commented Oct 31, 2016

We'll have to wait for thockin on the push. But I assume this will happen soon. Will let you know.

@thockin
Copy link
Member Author

thockin commented Nov 2, 2016

Pushed to GCR

On Mon, Oct 31, 2016 at 12:37 PM, Michael Grosser notifications@github.com
wrote:

We'll have to wait for thockin on the push. But I assume this will happen
soon. Will let you know.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#20 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFVgVAIcPgMZX8Ihv_EYAE3JBF3gUmEoks5q5dLrgaJpZM4Kjlwm
.

@thockin thockin deleted the use-build-template branch October 31, 2020 06: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.

4 participants