diff --git a/reweave/BUILDING.md b/reweave/BUILDING.md index 593cf159..8ee5efc0 100644 --- a/reweave/BUILDING.md +++ b/reweave/BUILDING.md @@ -2,7 +2,7 @@ This new build process is based on a multi-stage Dockerfile, which combines the build image Dockerfile and all the template-generated final image Dockerfiles from the [old build process](BUILDING-OLD.md). -> NOTE: The new process currently does not build the weave Docker plugin. Nor does it run any tests. This may change in the future. +> NOTE: The new process currently does not ~~build the weave Docker plugin. Nor does it~~ run any tests. This may change in the future. The new process is controlled by a Makefile, located at `reweave/Makefile`. This calls scripts located at `reweave/tools`. In the future, we should try to maintain this "harness", and only add/change the scripts as required. So, going forward, all anyone has to do is `cd reweave && make build && make scan`, no matter how the build process is evolved. @@ -26,7 +26,7 @@ After you make code or configurations changes, run the following in the `reweave make ``` -This will build all weave net images for your local platform, tag them with your repo user name, and load them to your local docker engine. +This will build all weave net images for your local platform(single-architecture), tag them with your repo user name, and load them to your local docker engine. Once the images are built, you can scan the `weave-kube` and `weave-npc` images by running: @@ -40,7 +40,7 @@ This will scan the images and generate reports in the [scans](scans/) directory. 1. Change `IMAGE_VERSION` and `REGISTRY_USER` variables in [reweave/Makefile](Makefile) to their final, publishable versions. 2. Build and scan as you would for development. -3. When satisfied, commit and tag your changes. **Do this before the next steps**. +3. When satisfied, commit and tag your changes. **Do this before the next steps, because git metadata is picked from your repository.**. 4. Login to your registry account using `docker login`. 5. Run the following: @@ -75,7 +75,7 @@ It starts from `builderbase` as the base, and does the following: * Sets environment variables indicating the current build and target architectures * Copies in the source code * Downloads modules -* Uses the [Makefile](#makefile) to build all weave net executables for the target architecture +* Uses a [Makefile](build/Makefilemakefile) to build all weave net executables for the target architecture #### Stage 3 (alpinebase) @@ -99,13 +99,13 @@ This makefile controls the build and scan processes. It provides the following p |---|---|---| |IMAGE_VERSION|The tag part of the name (after `:`) for all weave net images.|*version set in makefile*| |REGISTRY_USER|The account name (with optional registry name in front) used to tag all weave net images.|`weaveworks`| -|ALPINE_BASEIMAGE|The qualified name for the base Alpine image used to build all weave net images.|`alpine:3.17.2`| +|ALPINE_BASEIMAGE|The qualified name for the base Alpine image used to build all weave net images.|`alpine:3.18.2`| and the following targets: |Target|Description| |---|---| -|build-images|Builds images matching the architecture of the local Docker engine, and loads it into the local Docker engine.| +|build-images|Builds images matching the architecture of the local Docker engine, and loads it into the local Docker engine. This is the default target.| |publish-images|Builds multi-architecture images for all configured architectures, and pushes them to the registry.| |clean-images|Removes images from the local docker engine.| |build-plugin|Builds the [weave Docker Network Plugin(v2)](https://www.weave.works/docs/net/latest/install/plugin/plugin-v2/) on the local Docker engine. Requires published images.| @@ -122,20 +122,34 @@ This script invokes `docker buildx build` for each stage from stage 4 onwards. B |Env Var Name|Description|Default Value| |---|---|---| -|IMAGE_VERSION|The tag part of the name (after `:`) for all weave net images.|*version set in script file*| -|REGISTRY_USER|The account name (with optional registry name in front) used to tag all weave net images.|`weaveworks`| -|ALPINE_BASEIMAGE|The qualified name for the base Alpine image used to build all weave net images.|`alpine:3.17.2`| +|IMAGE_VERSION|The tag part of the name (after `:`) for all weave net images.|*version set in Makefile*| +|REGISTRY_USER|The account name (with optional registry name in front) used to tag all weave net images.|*user set in Makefile*| +|ALPINE_BASEIMAGE|The qualified name for the base Alpine image used to build all weave net images.|`alpine:3.18.2`| |PLATFORMS|Comma-separated list of the target platforms for which the weave net images will be built.|`linux/amd64,linux/arm,linux/arm64,linux/ppc64le,linux/s390x`| -|POSTBUILD|Whether to push the images after build (`--push`) , or load them to the local Docker engine (`--load`). `--load` is only possible if PLATFORMS has the same value as the build platform. If left empty, the images will be built in the build cache only.|| - -### reweave/tools/scan-images.sh - -This script scans the weave-kube and weave-npc images using grype. It saves scan results in the directory `reweave/scans`. +|PUBLISH|Whether to push the images after build (`true`) , or load them to the local Docker engine (`false`). `false` is only possible if PLATFORMS has the same value as the build platform. If left empty, the images will be built in the build cache only.|| ### reweave/tools/clean-images.sh This script deletes the built images from the local Docker engine. +### reweave/tools/build-plugin.sh + +This script builds the weave managed network plugin on the local Docker engine. It requires the following environment variables to be set: + +|Env Var Name|Description|Default Value| +|---|---|---| +|IMAGE_VERSION|The tag part of the name (after `:`) for the plugin.|*version set in Makefile*| +|REGISTRY_USER|The account name (with optional registry name in front) used to tag all weave net images.|*user set in Makefile*| +|PUBLISH|Whether to push the plugin to the Docker Hub after build (`true`) , or not (`false` or empty).|| + +### reweave/tools/clean-plugin.sh + +This script deletes the weave managed plugin from the local Docker engine. + +### reweave/tools/scan-images.sh + +This script scans the weave-kube and weave-npc images using [grype](https://github.com/anchore/grype). It saves scan results in the directory `reweave/scans`. + ### reweave/tools/clean-scans.sh This script clears the `reweave/scans` directory. diff --git a/reweave/CHANGELOG.md b/reweave/CHANGELOG.md index 9e170830..83936db5 100644 --- a/reweave/CHANGELOG.md +++ b/reweave/CHANGELOG.md @@ -2,14 +2,21 @@ All changes made to the weave net codebase during the reweave effort will be documented in this file. -## 2.8.2-beta9 +## latest + +### Changed + +* Updated documentation +* Changed [reweave/tool/build-images.sh](reweave/tool/build-images.sh) to be consistent with documentation + +## 2.8.2-beta9 (c085ebed) ### Changed * Ran `go mod tidy` to remove unused references * Included tools and build steps to build the docker plugin (v2) -## 2.8.2-beta8 +## 2.8.2-beta8 (668bbcf4) ### Changed @@ -17,13 +24,13 @@ All changes made to the weave net codebase during the reweave effort will be doc * Upgraded github.com/docker/docker to v23.0.3+incompatible * Upgraded github.com/docker/distribution to v2.8.2-beta.1+incompatible -## 2.8.2-beta7 +## 2.8.2-beta7 (4b47fc60) ### Changed * Alpine base image was changed to `alpine:3.18.2` -## 2.8.2-beta6 +## 2.8.2-beta6 (559027b4) ### Changed @@ -34,7 +41,7 @@ All changes made to the weave net codebase during the reweave effort will be doc * Corrections were made in `reweave/build/Dockerfile` to ensure it builds everywhere, specifically on M1 Macs too * `ALPINE_BASEIMAGE` was added as a parameter to `reweave/Makefile`. Now all changeable parameters are in one place -## 2.8.2-beta5 +## 2.8.2-beta5 (88d8bb64) Docker, containerd and runc dependencies were upgraded here. @@ -45,7 +52,7 @@ Docker, containerd and runc dependencies were upgraded here. * Upgraded github.com/docker/docker to v23.0.1+incompatible * Upgraded github.com/docker/distribution to v2.8.1+incompatible -## 2.8.2-beta4 +## 2.8.2-beta4 (1bb1f02b) CNI, which introduced breaking changes, was upgraded here. The majority of this work was already done in the unmerged pull request [3939](https://github.com/weaveworks/weave/pull/3939) by by @hswong3i. All credit to them @@ -64,7 +71,7 @@ CNI, which introduced breaking changes, was upgraded here. The majority of this * Changed `prog/kube-utils/main.go` due to an observed change in behavior * Changed `weave` script in project root, to add `disableCheck: true` in cni config. This is as per information found [here](https://www.cni.dev/docs/spec-upgrades/#changes-in-cni-v04) and [here](https://www.cni.dev/docs/spec/#configuration-format) -## 2.8.2-beta3 +## 2.8.2-beta3 (2f49b845) github.com/miekg/dns was upgraded here @@ -81,7 +88,7 @@ github.com/miekg/dns was upgraded here * Deleted check for ErrTruncated in nameserver/dns.go:276:32 * Modified nameserver/dns_test.go to remove dns.ErrTruncated-based tests -## 2.8.2-beta2 +## 2.8.2-beta2 (df2240ac) Some low-impact vulnerable dependencies were upgraded here @@ -93,14 +100,14 @@ Some low-impact vulnerable dependencies were upgraded here * Upgraded github.com/prometheus/client_golang to **v1.14.0** * Upgraded k8s.io/client-go to **v0.23.0** -## 2.8.2-beta1 +## 2.8.2-beta1 (c241c455) ### Changed * Bumped go version in `go.mod` to `1.20`. This caused an error in `go mod tidy` * Manually ran `go get github.com/andybalholm/go-bit@v1.0.1`. `go mod tidy` and `go mod vendor` worked -## 2.8.2-beta0 +## 2.8.2-beta0 (90a5d945) A new build process was created here. diff --git a/reweave/Makefile b/reweave/Makefile index 2a689fcb..98307aab 100644 --- a/reweave/Makefile +++ b/reweave/Makefile @@ -9,6 +9,7 @@ build-images: submodule REGISTRY_USER=${REGISTRY_USER} IMAGE_VERSION=${IMAGE_VERSION} \ PLATFORMS="$$(docker version -f '{{ .Server.Arch }}')" \ ALPINE_BASEIMAGE=$(ALPINE_BASEIMAGE) \ + PUBLISH=false \ tools/build-images.sh .PHONY: build-plugin diff --git a/reweave/README.md b/reweave/README.md index 5f3a84a6..103fd52c 100644 --- a/reweave/README.md +++ b/reweave/README.md @@ -15,11 +15,11 @@ The current focus of this effort is running weave net as a CNI plugin on Kuberne * ~~Document the old build process~~Old build process documented in [BUILDING-OLD.md](BUILDING-OLD.md) * ~~Create a image scanning process and scan current image~~Image scanning process created, scan reports generated for 2.8.1 * ~~Create a new build process~~New build process created, documented in [BUILDING.md](BUILDING.md) -* ~~Build, generate and test current images~~Built and scanned v2.8.2-beta0 +* ~~Build, generate and test current images~~Built and scanned v2.8.2-beta* * ~~Upgrade Go compiler version~~Go version upgraded to 1.20 * Scan images for CVEs * While there are fixable CVEs: * Upgrade dependencies using CVE list as guideline * Build, generate new images, test * Scan new images for CVEs -After a few rounds of the above, the current image version is v2.8.2-beta6, and several components have been upgraded (details in the [CHANGELOG](CHANGELOG.md)). \ No newline at end of file +After a few rounds of the above, several components have been upgraded (details in the [CHANGELOG](CHANGELOG.md)). This process will continue. \ No newline at end of file diff --git a/reweave/tools/build-images.sh b/reweave/tools/build-images.sh index 4b8aee7f..4a21b53c 100755 --- a/reweave/tools/build-images.sh +++ b/reweave/tools/build-images.sh @@ -13,7 +13,7 @@ fi # These variables are used to control the build process # Change with care. -: "${ALPINE_BASEIMAGE:=alpine:3.17.3}" +: "${ALPINE_BASEIMAGE:=alpine:3.18.2}" : "${WEAVE_VERSION=git-$(git rev-parse --short=12 HEAD)}" : "${GIT_REVISION=$(git rev-parse HEAD)}" : "${PLATFORMS:=linux/amd64,linux/arm,linux/arm64,linux/ppc64le,linux/s390x}" @@ -22,9 +22,9 @@ fi if [ "$PUBLISH" = "true" ]; then POSTBUILD="--push" elif [ "$PUBLISH" = "false" ]; then - POSTBUILD="" -else POSTBUILD="--load" +else + POSTBUILD="" fi # These are the names of the images