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

make process fails for source trees without .git directory #1711

Closed
dekobon opened this issue Jun 30, 2021 · 1 comment · Fixed by #1712
Closed

make process fails for source trees without .git directory #1711

dekobon opened this issue Jun 30, 2021 · 1 comment · Fixed by #1712

Comments

@dekobon
Copy link
Contributor

dekobon commented Jun 30, 2021

Describe the bug
After the v1.12.0 release, you can no longer download a tar.gz archive of a tagged version kubernetes-ingress from github and build the ingress controller because the archive does not contain a .git directory.

To Reproduce
Steps to reproduce the behavior:

  1. Download a tar archive of v1.12.0 from github.
  2. Extract the archive.
  3. Run make debian-image TARGET=container
  4. The following error occurs:
make debian-image TARGET=container
Docker version 20.10.7, build f0df350
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
docker build --build-arg IC_VERSION=-SNAPSHOT- --build-arg GIT_COMMIT= --build-arg DATE=2021-06-30T18:13:46Z --target container -f build/Dockerfile -t nginx/nginx-ingress:-SNAPSHOT- . --build-arg BUILD_OS=debian
invalid argument "nginx/nginx-ingress:-SNAPSHOT-" for "-t, --tag" flag: invalid reference format
See 'docker build --help'.
make: *** [Makefile:60: debian-image] Error 125

Expected behavior
I would expect the same behavior present in v1.11.3 where the build process warns about .git not being present, but continues without failure. Many open source applications and tools build directly from source extracted from archives. This is so common that it is a community norm to include everything needed in the distributed archive.

When building with the v1.11.3 source, it executes without a problem as follows.

make debian-image TARGET=container                                      
Docker version 20.10.7, build f0df350
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
docker build --build-arg IC_VERSION=1.11.3- --build-arg GIT_COMMIT= --build-arg VERSION=1.11.3 --target container -f build/Dockerfile -t nginx/nginx-ingress:1.11.3 . --build-arg BUILD_OS=debian
[+] Building 2.5s (19/19) FINISHED                                                                  
 => [internal] load build definition from Dockerfile                                           0.1s
 => => transferring dockerfile: 38B                                                            0.0s
 => [internal] load .dockerignore                                                              0.1s
 => => transferring context: 34B                                                               0.0s
 => resolve image config for docker.io/docker/dockerfile:1.0-experimental                      0.8s
 => CACHED docker-image://docker.io/docker/dockerfile:1.0-experimental@sha256:cbd6491240cc889  0.0s
 => [internal] load build definition from Dockerfile                                           0.0s
 => => transferring dockerfile: 38B                                                            0.0s
 => [internal] load .dockerignore                                                              0.0s
 => [internal] load metadata for docker.io/library/golang:1.16-alpine                          0.6s
 => [internal] load metadata for docker.io/library/nginx:1.21.0                                0.7s
 => [debian 1/2] FROM docker.io/library/nginx:1.21.0@sha256:47ae43cdfc7064d28800bc42e79a42954  0.0s
 => [internal] helper image for file operations                                                0.0s
 => [builder 1/3] FROM docker.io/library/golang:1.16-alpine@sha256:45f32e963bb3cc408cfcd01a8e  0.0s
 => [internal] load build context                                                              0.3s
 => => transferring context: 346.81kB                                                          0.3s
 => CACHED [debian 2/2] RUN apt-get update  && apt-get install --no-install-recommends --no-i  0.0s
 => CACHED [files 1/2] RUN mkdir -p /var/lib/nginx /etc/nginx/secrets /etc/nginx/stream-conf.  0.0s
 => CACHED [files 2/2] COPY internal/configs/version1/nginx.ingress.tmpl  internal/configs/ve  0.0s
 => CACHED [builder 2/3] COPY . /go/src/github.com/nginxinc/kubernetes-ingress/nginx-ingress/  0.0s
 => CACHED [builder 3/3] RUN CGO_ENABLED=0 GOFLAGS='-mod=vendor'  go build -installsuffix cgo  0.0s
 => CACHED [container 1/1] COPY --chown=nginx:0 --from=builder /nginx-ingress /                0.0s
 => exporting to image                                                                         0.1s
 => => exporting layers                                                                        0.0s
 => => writing image sha256:0df4c5af657593f644c63868be9b13991ba4b1bfe14e240e2d6c1258d79be2c6   0.0s
 => => naming to docker.io/nginx/nginx-ingress:1.11.3 

Your environment

  • Version of the Ingress Controller: v1.12.0 tag

Additional context

If the build process would output a dummy value for the GIT_COMMIT and GIT_TAG variables in the Makefile, it could complete without errors. A PR will follow this issue with a suggested change to allow builds to still work by using dummy values.

@github-actions
Copy link

Hi @dekobon thanks for reporting!

Be sure to check out the docs while you wait for a human to take a look at this 🙂

Cheers!

lucacome pushed a commit that referenced this issue Jul 1, 2021
Fixes #1711
When executing make and building from a downloaded source
archive, there is no git history (.git directory) in the
source directory. This change allows the build to continue
despite that directory being missing. It does that by using
dummy values for GIT_COMMIT and GIT_TAG.
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 a pull request may close this issue.

1 participant