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 dist/startup can't read git-rev #897

Closed
ozdanborne opened this issue Jul 10, 2017 · 0 comments
Closed

make dist/startup can't read git-rev #897

ozdanborne opened this issue Jul 10, 2017 · 0 comments
Assignees
Labels

Comments

@ozdanborne
Copy link
Member

ozdanborne commented Jul 10, 2017

Expected Behavior

Current Behavior

A variable in the top of the makefile tries to get the git-revision. However, when it is mounted into the startup.go build container, it doesn't have access to the .git from it's parent directory, since that is not volume mounted in.

CALICO_GIT_VER := $(shell git describe --tags --dirty --always)

Possible Solution

Steps to Reproduce (for bugs)

Running make dist/startup will print the following error:

fatal: Not a git repository (or any parent up to mount point /go/src/github.com/projectcalico/calico/calico_node). Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

$ make dist/startup                                                                                                                                    
mkdir -p dist
mkdir -p .go-pkg-cache
docker run --rm \
	-e LOCAL_USER_ID=1000 \
	-v /home/turk/go/src/github.com/projectcalico/calico/calico_node/.go-pkg-cache:/go/pkg/:rw \
	-v /home/turk/go/src/github.com/projectcalico/calico/calico_node:/go/src/github.com/projectcalico/calico/calico_node:ro \
	-v /home/turk/go/src/github.com/projectcalico/calico/calico_node/dist:/go/src/github.com/projectcalico/calico/calico_node/dist \
	-v /home/turk/go/src/github.com/projectcalico/calico/calico_node//../_data/versions.yml:/versions.yaml:ro \
        -e VERSIONS_FILE=/versions.yaml \
  	calico/go-build:latest sh -c '\
    	cd /go/src/github.com/projectcalico/calico/calico_node && \
    	make startup'
Starting with UID : 1000
fatal: Not a git repository (or any parent up to mount point /go/src/github.com/projectcalico/calico/calico_node)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -v -i -o dist/startup -ldflags "-X main.VERSION=v2.3.0 -X main.GIT_REVISION=" startup/startup.go
command-line-arguments

Context

I'm trying to add versioning to startup.go.

tomdee added a commit to tomdee/calico that referenced this issue Jul 10, 2017
Change CALICO_GIT_VER to a "conditional variable". The git shell command
will only be run if a value isn't already defined.

This allows the non-containerized execution of `make` to fill in the
variable so that that git doesn't need to run inside the container.

Fixes projectcalico#897
caseydavenport pushed a commit that referenced this issue Dec 14, 2021
…-master

[master] Semaphore Auto Pin Update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants