From 383a9b3abceced805c7ab2d0892b3082722d161f Mon Sep 17 00:00:00 2001 From: ober Date: Wed, 20 Sep 2023 15:26:55 -0600 Subject: [PATCH 01/19] add debugging to fix branches --- .github/workflows/docker-image.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 95721699a..f74ee960c 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -16,6 +16,8 @@ jobs: docker-image: ['gerbil', 'gerbilxx'] steps: - uses: actions/checkout@v3 + - name: List of all Github Actions env vars + run: env - name: Build the Docker image run: make -C docker ${{ matrix.docker-image }} GERBIL_VERSION=${{github.head_ref}} - name: Push to Docker Hub on Pushes to master From 22f865ca422bb91a182832d0f4ade1093eff4328 Mon Sep 17 00:00:00 2001 From: ober Date: Wed, 20 Sep 2023 15:41:08 -0600 Subject: [PATCH 02/19] handle repo, and branch properly --- .github/workflows/docker-image.yml | 2 +- docker/Dockerfile | 10 +++++----- docker/Makefile | 13 ++++++------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index f74ee960c..85d5716c6 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -19,7 +19,7 @@ jobs: - name: List of all Github Actions env vars run: env - name: Build the Docker image - run: make -C docker ${{ matrix.docker-image }} GERBIL_VERSION=${{github.head_ref}} + run: make -C docker ${{ matrix.docker-image }} REPO=${{github.GITHUB_REPOSITORY}} BRANCH=${{github.GITHUB_HEAD_REF}} - name: Push to Docker Hub on Pushes to master run: | docker login -u gerbil -p ${{ secrets.DOCKER_TOKEN }} diff --git a/docker/Dockerfile b/docker/Dockerfile index 3b3384efb..61c39f557 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,6 +1,7 @@ ARG distro ARG with_db -ARG gerbil_version +ARG repo +ARG branch ARG cores ARG configure_args ARG packages @@ -9,7 +10,6 @@ FROM ${distro}:latest as base ARG cores ARG distro ARG with_db -ARG gerbil_version ARG packages ENV PATH=/opt/gerbil/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin ENV GERBIL_BUILD_CORES=$cores @@ -44,11 +44,11 @@ RUN case ${distro} in \ FROM base as gerbil ARG cores -ARG gerbil_version +ARG repo +ARG branch ARG configure_args ENV GERBIL_GCC=g++ -RUN cd /opt && git clone https://github.com/vyzo/gerbil gerbil-src -RUN cd /opt/gerbil-src && git fetch -a && git fetch --tags && git checkout ${gerbil_version} \ +RUN git clone -b ${branch} https://github.com/${repo} /opt/gerbil-src && eval ./configure --prefix=/opt/gerbil --enable-shared=no ${configure_args} RUN cd /opt/gerbil-src && make -j ${GERBIL_BUILD_CORES} && make install diff --git a/docker/Makefile b/docker/Makefile index af6a2c170..65ae5fe9f 100755 --- a/docker/Makefile +++ b/docker/Makefile @@ -1,16 +1,12 @@ .PHONY: alpine amazonlinux ubuntu fedora ubuntu-current-jedi final -$(info the branch is $(GERBIL_VERSION)) -ifeq ($(GERBIL_VERSION),) -GERBIL_VERSION := $(shell git symbolic-ref --short HEAD) -endif -$(info the branch is $(GERBIL_VERSION)) - ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) cores := $(shell nproc) arch := $(shell uname -m) DEFAULT=gerbilxx +$(info the branch is $(BRANCH) and the repo is $(REPO)) + alpine_packages := autoconf \ automake \ cmake \ @@ -85,6 +81,8 @@ gerbilxx: docker build --target final \ --rm=true --no-cache \ --build-arg gerbil_version=$(GERBIL_VERSION) \ + --build-arg repo="$(REPO)" \ + --build-arg branch="$(BRANCH)" \ --build-arg packages="$(alpine_packages)" \ --build-arg configure_args="--enable-leveldb --enable-libxml --enable-libyaml --enable-lmdb --enable-zlib --enable-c++ --enable-march=" \ --build-arg cores=$(cores) \ @@ -96,7 +94,8 @@ gerbilxx: gerbil: docker build --target final \ --rm=true --no-cache \ - --build-arg gerbil_version=$(GERBIL_VERSION) \ + --build-arg repo="$(REPO)" \ + --build-arg branch="$(BRANCH)" \ --build-arg packages="$(alpine_packages)" \ --build-arg configure_args="--enable-march=" \ --build-arg cores=$(cores) \ From b69fdc437e8ec93589ca7d87f47b634d72da0fae Mon Sep 17 00:00:00 2001 From: ober Date: Wed, 20 Sep 2023 15:42:10 -0600 Subject: [PATCH 03/19] need \ --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 61c39f557..fe2e57aac 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -48,7 +48,7 @@ ARG repo ARG branch ARG configure_args ENV GERBIL_GCC=g++ -RUN git clone -b ${branch} https://github.com/${repo} /opt/gerbil-src +RUN git clone -b ${branch} https://github.com/${repo} /opt/gerbil-src \ && eval ./configure --prefix=/opt/gerbil --enable-shared=no ${configure_args} RUN cd /opt/gerbil-src && make -j ${GERBIL_BUILD_CORES} && make install From 6de5bab390dc46f7f4b1e6546d67e14b0a083a64 Mon Sep 17 00:00:00 2001 From: ober Date: Wed, 20 Sep 2023 15:45:17 -0600 Subject: [PATCH 04/19] fix location --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index fe2e57aac..015736c9c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -48,7 +48,7 @@ ARG repo ARG branch ARG configure_args ENV GERBIL_GCC=g++ -RUN git clone -b ${branch} https://github.com/${repo} /opt/gerbil-src \ +RUN cd /opt && git clone -b ${branch} https://github.com/${repo} gerbil-src \ && eval ./configure --prefix=/opt/gerbil --enable-shared=no ${configure_args} RUN cd /opt/gerbil-src && make -j ${GERBIL_BUILD_CORES} && make install From 1fd0206256b93458829fb6c84be804a7d316ddbc Mon Sep 17 00:00:00 2001 From: ober Date: Wed, 20 Sep 2023 15:48:03 -0600 Subject: [PATCH 05/19] fix names --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 85d5716c6..696cd8a08 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -19,7 +19,7 @@ jobs: - name: List of all Github Actions env vars run: env - name: Build the Docker image - run: make -C docker ${{ matrix.docker-image }} REPO=${{github.GITHUB_REPOSITORY}} BRANCH=${{github.GITHUB_HEAD_REF}} + run: make -C docker ${{ matrix.docker-image }} REPO=${{GITHUB_REPOSITORY}} BRANCH=${{GITHUB_HEAD_REF}} - name: Push to Docker Hub on Pushes to master run: | docker login -u gerbil -p ${{ secrets.DOCKER_TOKEN }} From 18036f4019d591b5a3acd03ee0feb9670354472c Mon Sep 17 00:00:00 2001 From: ober Date: Wed, 20 Sep 2023 15:54:25 -0600 Subject: [PATCH 06/19] use github again --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 696cd8a08..4cc022d56 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -19,7 +19,7 @@ jobs: - name: List of all Github Actions env vars run: env - name: Build the Docker image - run: make -C docker ${{ matrix.docker-image }} REPO=${{GITHUB_REPOSITORY}} BRANCH=${{GITHUB_HEAD_REF}} + run: make -C docker ${{ matrix.docker-image }} REPO=${{ github.GITHUB_REPOSITORY }} BRANCH=${{ github.GITHUB_HEAD_REF }} - name: Push to Docker Hub on Pushes to master run: | docker login -u gerbil -p ${{ secrets.DOCKER_TOKEN }} From b64c75c720d20f192aec92fd212a7e3a9cb386bb Mon Sep 17 00:00:00 2001 From: ober Date: Wed, 20 Sep 2023 16:00:40 -0600 Subject: [PATCH 07/19] print out github context --- .github/workflows/docker-image.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 4cc022d56..e7a7060df 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -16,6 +16,10 @@ jobs: docker-image: ['gerbil', 'gerbilxx'] steps: - uses: actions/checkout@v3 + - name: print out github context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" - name: List of all Github Actions env vars run: env - name: Build the Docker image From 4061d113f480040c4a3a14c5de482acd925238b0 Mon Sep 17 00:00:00 2001 From: ober Date: Wed, 20 Sep 2023 16:20:43 -0600 Subject: [PATCH 08/19] fix variable names --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index e7a7060df..7675d565a 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -23,7 +23,7 @@ jobs: - name: List of all Github Actions env vars run: env - name: Build the Docker image - run: make -C docker ${{ matrix.docker-image }} REPO=${{ github.GITHUB_REPOSITORY }} BRANCH=${{ github.GITHUB_HEAD_REF }} + run: make -C docker ${{ matrix.docker-image }} REPO=${{ github.repository }} BRANCH=${{ github.head_ref }} - name: Push to Docker Hub on Pushes to master run: | docker login -u gerbil -p ${{ secrets.DOCKER_TOKEN }} From 5b40e6e9b019eb89f96b2d0990c75bacc48a25ed Mon Sep 17 00:00:00 2001 From: ober Date: Wed, 20 Sep 2023 16:20:50 -0600 Subject: [PATCH 09/19] add defaults --- docker/Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docker/Makefile b/docker/Makefile index 65ae5fe9f..1b638479a 100755 --- a/docker/Makefile +++ b/docker/Makefile @@ -5,6 +5,14 @@ cores := $(shell nproc) arch := $(shell uname -m) DEFAULT=gerbilxx +ifeq ($(BRANCH),) +BRANCH := $(shell git symbolic-ref --short HEAD) +endif + +ifeq ($(REPO),) +REPO := "https://github.com/might-gerbils/gerbil" +endif + $(info the branch is $(BRANCH) and the repo is $(REPO)) alpine_packages := autoconf \ From 1a242d1f8bb6568b2ad8ac7dd0b10920cba7ea11 Mon Sep 17 00:00:00 2001 From: ober Date: Wed, 20 Sep 2023 16:23:29 -0600 Subject: [PATCH 10/19] eval --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 015736c9c..60cb44e33 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -48,7 +48,7 @@ ARG repo ARG branch ARG configure_args ENV GERBIL_GCC=g++ -RUN cd /opt && git clone -b ${branch} https://github.com/${repo} gerbil-src \ +RUN cd /opt && eval git clone -b ${branch} https://github.com/${repo} gerbil-src \ && eval ./configure --prefix=/opt/gerbil --enable-shared=no ${configure_args} RUN cd /opt/gerbil-src && make -j ${GERBIL_BUILD_CORES} && make install From 5b3398d76667062f438fab254c6653b701d23dd2 Mon Sep 17 00:00:00 2001 From: ober Date: Wed, 20 Sep 2023 16:26:12 -0600 Subject: [PATCH 11/19] cd there too --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 60cb44e33..485f1d1d0 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -49,7 +49,7 @@ ARG branch ARG configure_args ENV GERBIL_GCC=g++ RUN cd /opt && eval git clone -b ${branch} https://github.com/${repo} gerbil-src \ - && eval ./configure --prefix=/opt/gerbil --enable-shared=no ${configure_args} + && cd /opt/gerbil_src && eval ./configure --prefix=/opt/gerbil --enable-shared=no ${configure_args} RUN cd /opt/gerbil-src && make -j ${GERBIL_BUILD_CORES} && make install From bc7322b9e08bfd7f9c9281923ade091de5e1ed49 Mon Sep 17 00:00:00 2001 From: ober Date: Wed, 20 Sep 2023 16:28:58 -0600 Subject: [PATCH 12/19] hyphens... --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 485f1d1d0..c78dba9e8 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -49,7 +49,7 @@ ARG branch ARG configure_args ENV GERBIL_GCC=g++ RUN cd /opt && eval git clone -b ${branch} https://github.com/${repo} gerbil-src \ - && cd /opt/gerbil_src && eval ./configure --prefix=/opt/gerbil --enable-shared=no ${configure_args} + && cd /opt/gerbil-src && eval ./configure --prefix=/opt/gerbil --enable-shared=no ${configure_args} RUN cd /opt/gerbil-src && make -j ${GERBIL_BUILD_CORES} && make install From f5445028a0eaeca32b1c740e70e421f3b7109538 Mon Sep 17 00:00:00 2001 From: ober Date: Wed, 20 Sep 2023 16:37:05 -0600 Subject: [PATCH 13/19] handle repo properly --- docker/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Makefile b/docker/Makefile index 1b638479a..57627486f 100755 --- a/docker/Makefile +++ b/docker/Makefile @@ -10,7 +10,7 @@ BRANCH := $(shell git symbolic-ref --short HEAD) endif ifeq ($(REPO),) -REPO := "https://github.com/might-gerbils/gerbil" +REPO := "might-gerbils/gerbil" endif $(info the branch is $(BRANCH) and the repo is $(REPO)) From bf17b66aaeefa7ab5e3e7631f40fb88a0fd92cc1 Mon Sep 17 00:00:00 2001 From: ober Date: Wed, 20 Sep 2023 16:41:14 -0600 Subject: [PATCH 14/19] fix name --- docker/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Makefile b/docker/Makefile index 57627486f..ac3e4706b 100755 --- a/docker/Makefile +++ b/docker/Makefile @@ -10,7 +10,7 @@ BRANCH := $(shell git symbolic-ref --short HEAD) endif ifeq ($(REPO),) -REPO := "might-gerbils/gerbil" +REPO := "mighty-gerbils/gerbil" endif $(info the branch is $(BRANCH) and the repo is $(REPO)) From ea08789b755a28f4c3a97b7bd9aeee3375c22687 Mon Sep 17 00:00:00 2001 From: ober Date: Wed, 20 Sep 2023 16:54:37 -0600 Subject: [PATCH 15/19] add core info --- docker/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/Makefile b/docker/Makefile index ac3e4706b..83098f170 100755 --- a/docker/Makefile +++ b/docker/Makefile @@ -13,7 +13,8 @@ ifeq ($(REPO),) REPO := "mighty-gerbils/gerbil" endif -$(info the branch is $(BRANCH) and the repo is $(REPO)) +cores := $(shell nproc) +$(info the branch is $(BRANCH) and the repo is $(REPO) cores are: $(cores)) alpine_packages := autoconf \ automake \ From d4f209f8498d173b8ab6b90e34bbc6c964e8ba16 Mon Sep 17 00:00:00 2001 From: ober Date: Thu, 21 Sep 2023 11:40:50 -0600 Subject: [PATCH 16/19] quote the variables --- .github/workflows/docker-image.yml | 2 +- docker/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 7675d565a..7176d18f8 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -23,7 +23,7 @@ jobs: - name: List of all Github Actions env vars run: env - name: Build the Docker image - run: make -C docker ${{ matrix.docker-image }} REPO=${{ github.repository }} BRANCH=${{ github.head_ref }} + run: make -C docker ${{ matrix.docker-image }} REPO="${{ github.repository }}" BRANCH="${{ github.head_ref }}" - name: Push to Docker Hub on Pushes to master run: | docker login -u gerbil -p ${{ secrets.DOCKER_TOKEN }} diff --git a/docker/Dockerfile b/docker/Dockerfile index c78dba9e8..8dc5986dc 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -48,7 +48,7 @@ ARG repo ARG branch ARG configure_args ENV GERBIL_GCC=g++ -RUN cd /opt && eval git clone -b ${branch} https://github.com/${repo} gerbil-src \ +RUN cd /opt && eval git clone -b "${branch}" "https://github.com/${repo}" gerbil-src \ && cd /opt/gerbil-src && eval ./configure --prefix=/opt/gerbil --enable-shared=no ${configure_args} RUN cd /opt/gerbil-src && make -j ${GERBIL_BUILD_CORES} && make install From ed1cc840ea5fd034aeee9d4eea975605d55c0c19 Mon Sep 17 00:00:00 2001 From: ober Date: Thu, 21 Sep 2023 13:03:56 -0600 Subject: [PATCH 17/19] default to master --- docker/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Makefile b/docker/Makefile index 83098f170..6a17475d9 100755 --- a/docker/Makefile +++ b/docker/Makefile @@ -6,7 +6,7 @@ arch := $(shell uname -m) DEFAULT=gerbilxx ifeq ($(BRANCH),) -BRANCH := $(shell git symbolic-ref --short HEAD) +BRANCH := "master" endif ifeq ($(REPO),) From c6d50dc2fff975169a4871a40507b83f4169575f Mon Sep 17 00:00:00 2001 From: ober Date: Thu, 21 Sep 2023 15:55:02 -0600 Subject: [PATCH 18/19] invert logic --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 7176d18f8..27fc23e6e 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -28,4 +28,4 @@ jobs: run: | docker login -u gerbil -p ${{ secrets.DOCKER_TOKEN }} docker push gerbil/${{ matrix.docker-image }}:$(uname -m) - if: github.event_name != 'pull_request' + if: github.event_name == 'push' From 549a6ac9be083917bc12ba9e76d523b025e8c196 Mon Sep 17 00:00:00 2001 From: ober Date: Thu, 21 Sep 2023 16:01:32 -0600 Subject: [PATCH 19/19] handle master properly --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 27fc23e6e..87ae7c333 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -23,7 +23,7 @@ jobs: - name: List of all Github Actions env vars run: env - name: Build the Docker image - run: make -C docker ${{ matrix.docker-image }} REPO="${{ github.repository }}" BRANCH="${{ github.head_ref }}" + run: make -C docker ${{ matrix.docker-image }} REPO=${{ github.repository }} BRANCH=${{ github.head_ref || github.ref_name }} - name: Push to Docker Hub on Pushes to master run: | docker login -u gerbil -p ${{ secrets.DOCKER_TOKEN }}