Skip to content

Commit

Permalink
Remove unused hard link targets in Makefile
Browse files Browse the repository at this point in the history
We use $BINARY_NAME-$ARCH format in Calico builds and packaging
containers. The hard link targets in Makefile are not used and can be
removed. When building multiarchs, new links without $ARCH in the
binary name will overwrite existing ones which may cause unexpected
behaviors.
  • Loading branch information
hjiawei committed Oct 20, 2023
1 parent 9fc6b04 commit b5973f5
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 75 deletions.
15 changes: 4 additions & 11 deletions confd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,14 @@ clean:
###############################################################################
# Building the binary
###############################################################################
build: bin/confd
build: bin/confd-$(ARCH)
build-all: $(addprefix sub-build-,$(VALIDARCHES))
sub-build-%:
$(MAKE) build ARCH=$*

bin/confd-$(ARCH): $(SRC_FILES)
$(call build_static_cgo_boring_binary, $(PACKAGE_NAME), $@)

bin/confd: bin/confd-$(ARCH)
ifeq ($(ARCH),amd64)
ln -f bin/confd-$(ARCH) bin/confd
endif
ifeq ($(ARCH),s390x)
ln -f bin/confd-$(ARCH) bin/confd
endif
ln -sf confd-$(ARCH) bin/confd

###############################################################################
# Unit Tests
Expand All @@ -52,7 +45,7 @@ UPDATE_EXPECTED_DATA?=false

.PHONY: test-kdd
## Run template tests against KDD
test-kdd: bin/confd bin/kubectl bin/bird bin/bird6 bin/calico-node bin/calicoctl bin/typha run-k8s-apiserver
test-kdd: bin/confd-$(ARCH) bin/kubectl bin/bird bin/bird6 bin/calico-node bin/calicoctl bin/typha run-k8s-apiserver
-git clean -fx etc/calico/confd
mkdir -p tests/logs
docker run --rm --net=host \
Expand Down Expand Up @@ -85,7 +78,7 @@ test-kdd: bin/confd bin/kubectl bin/bird bin/bird6 bin/calico-node bin/calicoctl

.PHONY: test-etcd
## Run template tests against etcd
test-etcd: bin/confd bin/etcdctl bin/bird bin/bird6 bin/calico-node bin/kubectl bin/calicoctl run-etcd run-k8s-apiserver
test-etcd: bin/confd-$(ARCH) bin/etcdctl bin/bird bin/bird6 bin/calico-node bin/kubectl bin/calicoctl run-etcd run-k8s-apiserver
-git clean -fx etc/calico/confd
mkdir -p tests/logs
docker run --rm --net=host \
Expand Down
7 changes: 0 additions & 7 deletions felix/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -576,9 +576,6 @@ cover-report: combined.coverprofile
column -t | \
grep -v '100\.0%'"

bin/calico-felix.transfer-url: bin/calico-felix
$(DOCKER_GO_BUILD) sh -c 'curl --upload-file bin/calico-felix https://transfer.sh/calico-felix > $@'

# Cross-compile Felix for Windows
bin/calico-felix.exe: $(SRC_FILES)
@echo Building felix for Windows...
Expand All @@ -588,10 +585,6 @@ bin/calico-felix.exe: $(SRC_FILES)
( ldd $@ 2>&1 | grep -q "Not a valid dynamic program\|not a dynamic executable" || \
( echo "Error: $@ was not statically linked"; false ) )'

.PHONY: patch-script
patch-script: bin/calico-felix.transfer-url
$(DOCKER_GO_BUILD) bash -c 'utils/make-patch-script.sh $$(cat bin/calico-felix.transfer-url)'

## Generate a diagram of Felix's internal calculation graph.
docs/calc.pdf: docs/calc.dot
cd docs/ && dot -Tpdf calc.dot -o calc.pdf
Expand Down
21 changes: 0 additions & 21 deletions felix/utils/make-patch-script.sh

This file was deleted.

11 changes: 1 addition & 10 deletions typha/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,11 @@ clean:
###############################################################################
# Building the binary
###############################################################################
build: $(BINDIR)/calico-typha
build: $(BINDIR)/calico-typha-$(ARCH)
build-all: $(addprefix sub-build-,$(VALIDARCHES))
sub-build-%:
$(MAKE) build ARCH=$*

$(BINDIR)/calico-typha: $(BINDIR)/calico-typha-$(ARCH)
ln -f $(BINDIR)/calico-typha-$(ARCH) $(BINDIR)/calico-typha

$(BINDIR)/wrapper: $(BINDIR)/wrapper-$(ARCH)
ln -f $(BINDIR)/wrapper-$(ARCH) $(BINDIR)/wrapper

$(BINDIR)/wrapper-$(ARCH): $(SRC_FILES) $(LOCAL_BUILD_DEP)
ifeq ($(ARCH), amd64)
ifeq ($(FIPS), true)
Expand Down Expand Up @@ -281,9 +275,6 @@ cover-report: combined.coverprofile
column -t | \
grep -v '100\.0%'"

$(BINDIR)/calico-typha.transfer-url: $(BINDIR)/calico-typha-$(ARCH)
$(DOCKER_RUN) $(CALICO_BUILD) sh -c 'curl --upload-file $(BINDIR)/calico-typha-$(ARCH) https://transfer.sh/calico-typha > $@'

# Install or update the tools used by the build
.PHONY: update-tools
update-tools:
Expand Down
55 changes: 29 additions & 26 deletions typha/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
[![Build Status](https://semaphoreci.com/api/v1/calico/typha/branches/master/shields_badge.svg)](https://semaphoreci.com/calico/typha)
[![Coverage Status](https://coveralls.io/repos/github/projectcalico/typha/badge.svg?branch=master&cachebreaker=1)](https://coveralls.io/github/projectcalico/typha?branch=master)
[![Slack Status](https://slack.projectcalico.org/badge.svg)](https://slack.projectcalico.org)
[![IRC Channel](https://img.shields.io/badge/irc-%23calico-blue.svg)](https://kiwiirc.com/client/irc.freenode.net/#calico)
[![Go Report Card](https://goreportcard.com/badge/github.com/projectcalico/typha)](https://goreportcard.com/report/github.com/projectcalico/typha)
# Project Calico

<!--
<blockquote>
Note that the documentation in this repo is targeted at Calico contributors.
<h1>Documentation for Calico users is here:<br><a href="http://docs.projectcalico.org">http://docs.projectcalico.org</a></h1>
</blockquote>
-->
# Typha

This repository contains the source code for Project Calico's optional Typha daemon. An instance of Typha sits
between the datastore (such as the Kubernetes API server) and many instances of Felix.
Expand Down Expand Up @@ -74,38 +62,48 @@ To build Typha, you will need:
- GNU make.

Then, as a one-off, run
```

```bash
make update-tools
```
which will install a couple more go tools that we haven't yet containerised.

which will install a couple more go tools that we haven't yet containerized.

Then, to build the calico-typha binary:

```bash
make build
```
make bin/calico-typha
```

or, the `calico/typha` docker image:
```

```bash
make image
```

## How can I run Typha's unit tests?

To run all the UTs:
```

```bash
make ut
```

To start a `ginkgo watch`, which will re-run the relevant UTs as you update files:
```

```bash
make ut-watch
```

To get coverage stats:
```

```bash
make cover-report
```

or
```

```bash
make cover-browser
```

Expand All @@ -123,10 +121,12 @@ run Typha's unit tests.
There are several ways to run ginkgo. One option is to change directory to the
package you want to test, then run `ginkgo`. Another is to use ginkgo's
watch feature to monitor files for changes:
```

```bash
cd go
ginkgo watch -r
```

Ginkgo will re-run tests as files are modified and saved.

## How do I build packages/run Typha?
Expand All @@ -135,11 +135,14 @@ Ginkgo will re-run tests as files are modified and saved.

After building the docker image (see above), you can run Typha and log to screen
with, for example:
`docker run --privileged --net=host -e TYPHA_LOGSEVERITYSCREEN=INFO calico/typha`

```bash
docker run --privileged --net=host -e TYPHA_LOGSEVERITYSCREEN=INFO calico/typha
```

## License

Calico binaries are licensed under the [Apache v2.0 license](LICENSE), with the exception of some [GPL licensed eBPF programs](https://github.com/projectcalico/felix/tree/master/bpf-gpl).

Calico imports packages with a number of apache-compatible licenses. For more information, see [filesystem/licenses](./filesystem/licenses). In addition, the base container image contains
pre-packaged software with a variety of licenses.
Calico imports packages with a number of apache-compatible licenses. For more information, see [filesystem/licenses](./filesystem/licenses).
In addition, the base container image contains pre-packaged software with a variety of licenses.

0 comments on commit b5973f5

Please sign in to comment.