From e1ec98e248ab9cdaa5f648bad871994b7abcabc7 Mon Sep 17 00:00:00 2001 From: Brendan Abolivier Date: Wed, 22 May 2019 10:44:25 +0100 Subject: [PATCH] Update Docker files and remove references to gb (#703) Fix Docker files which had been forgotten in #594 and update scripts and docs to remove references to gb. I also removed the `jenkins` directory which is outdated. We can revert f8d7e99 if we realise that it was a mistake to do so. --- CONTRIBUTING.md | 25 +++++++------------------ docker/Dockerfile | 5 ++--- docker/build.sh | 4 ++-- docker/docker-compose.yml | 1 - jenkins/prepare-dendrite.sh | 13 ------------- jenkins/test-monolith.sh | 35 ----------------------------------- mediaapi/README.md | 2 +- scripts/build-test-lint.sh | 5 +---- 8 files changed, 13 insertions(+), 77 deletions(-) delete mode 100755 jenkins/prepare-dendrite.sh delete mode 100755 jenkins/test-monolith.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ef22b7f8..22ad0586 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,11 +12,13 @@ See [INSTALL.md](INSTALL.md) for instructions on setting up a running dev instance of dendrite, and [CODE_STYLE.md](CODE_STYLE.md) for the code style guide. -We use `gb` for managing our dependencies, so `gb build` and `gb test` is how -to build dendrite and run the unit tests respectively. Be aware that a list of -all dendrite packages is the expected output for all tests succeeding with `gb -test`. There are also [scripts](scripts) for [linting](scripts/find-lint.sh) -and doing a [build/test/lint run](scripts/build-test-lint.sh). +As of May 2019, we're not using `gb` anymore, which is the tool we had been +using for managing our dependencies. We're now using Go modules. To build +Dendrite, run the `build.sh` script at the root of this repository (which runs +`go install` under the hood), and to run unit tests, run `go test ./...` (which +should pick up any unit test and run it). There are also [scripts](scripts) for +[linting](scripts/find-lint.sh) and doing a [build/test/lint +run](scripts/build-test-lint.sh). ## Picking Things To Do @@ -33,18 +35,6 @@ nonetheless fairly well-contained. We ask people who are familiar with Dendrite to leave the [good first issue](https://github.com/matrix-org/dendrite/labels/good%20first%20issue) issues so that there is always a way for new people to come and get involved. -## Contributing to dependencies - -Dependencies are located in `vendor/src` and are managed by `gb`. If you need -to make some changes in those directories, you first need to open a PR in the -dependency repository. Once your PR is merged, you need to run `gb vendor -update $repo_url` (example: `gb vendor update github.com/matrix-org/gomatrix`) -in the dendrite repository to update the dependency. - -You can then create a commit containing only the modified vendor files (along -with the `vendor/manifest` file), name it with the command you just ran (ie -`gb vendor update github.com/matrix-org/gomatrix`), and open a PR on Dendrite. - ## Getting Help For questions related to developing on Dendrite we have a dedicated room on @@ -57,4 +47,3 @@ For more general questions please use [#dendrite:matrix.org](https://matrix.to/# We ask that everyone who contributes to the project signs off their contributions, in accordance with the [DCO](https://github.com/matrix-org/matrix-doc/blob/master/CONTRIBUTING.rst#sign-off). - diff --git a/docker/Dockerfile b/docker/Dockerfile index 6e3955d4..d8f9de42 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,10 +1,9 @@ -FROM golang:alpine3.6 +FROM docker.io/golang:1.12.5-alpine3.9 RUN mkdir /build WORKDIR /build -RUN apk --update --no-cache add openssl bash git && \ - go get github.com/constabulary/gb/... +RUN apk --update --no-cache add openssl bash git CMD ["bash", "docker/build.sh"] diff --git a/docker/build.sh b/docker/build.sh index a478c867..a3e3ca24 100644 --- a/docker/build.sh +++ b/docker/build.sh @@ -1,6 +1,6 @@ #!/bin/bash -gb build +./build.sh # Generate the keys if they don't already exist. if [ ! -f server.key ] || [ ! -f server.crt ] || [ ! -f matrix_key.pem ]; then @@ -12,7 +12,7 @@ if [ ! -f server.key ] || [ ! -f server.crt ] || [ ! -f matrix_key.pem ]; then -keyout server.key \ -out server.crt \ -days 3650 -nodes \ - -subj /CN=localhost + -subj /CN=localhost test -f matrix_key.pem || /build/bin/generate-keys -private-key matrix_key.pem fi diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index bde2f333..763e5b0f 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -7,7 +7,6 @@ services: build: ./ volumes: - ..:/build - - ./build/pkg:/build/pkg - ./build/bin:/build/bin networks: - internal diff --git a/jenkins/prepare-dendrite.sh b/jenkins/prepare-dendrite.sh deleted file mode 100755 index baa03abd..00000000 --- a/jenkins/prepare-dendrite.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# -# build the dendrite binaries into ./bin - -cd `dirname $0`/.. - -set -eux - -export GOPATH=`pwd`/.gopath -export PATH="${GOPATH}/bin:$PATH" - -go get github.com/constabulary/gb/... -gb build diff --git a/jenkins/test-monolith.sh b/jenkins/test-monolith.sh deleted file mode 100755 index 538447c1..00000000 --- a/jenkins/test-monolith.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -set -eux - -cd `dirname $0`/.. - -: ${WORKSPACE:="$(pwd)"} -export WORKSPACE - -# remove any detritus from last time -rm -f sytest/server-*/*.log sytest/results.tap - -./jenkins/prepare-dendrite.sh - -if [ ! -d "sytest" ]; then - git clone https://github.com/matrix-org/sytest.git --depth 1 --branch master -fi - -# Jenkins may have supplied us with the name of the branch in the -# environment. Otherwise we will have to guess based on the current -# commit. -: ${GIT_BRANCH:="origin/$(git rev-parse --abbrev-ref HEAD)"} - -git -C sytest fetch --depth 1 origin "${GIT_BRANCH}" || { - echo >&2 "No ref ${GIT_BRANCH} found, falling back to develop" - git -C sytest fetch --depth 1 origin develop -} - -git -C sytest reset --hard FETCH_HEAD - -./sytest/jenkins/prep_sytest_for_postgres.sh - -./sytest/jenkins/install_and_run.sh \ - -I Dendrite::Monolith \ - --dendrite-binary-directory "$WORKSPACE/bin" || true diff --git a/mediaapi/README.md b/mediaapi/README.md index 8d6cc627..baf5587f 100644 --- a/mediaapi/README.md +++ b/mediaapi/README.md @@ -18,7 +18,7 @@ See the sample below for image quality with nfnt/resize: ### bimg (uses libvips C library) -Alternatively one can use `gb build -tags bimg` to use bimg from https://github.com/h2non/bimg (MIT-licensed) which uses libvips from https://github.com/jcupitt/libvips (LGPL v2.1+ -licensed). libvips is a C library and must be installed/built separately. See the github page for details. Also note that libvips in turn has dependencies with a selection of FOSS licenses. +Alternatively one can use `go build -tags bimg` to use bimg from https://github.com/h2non/bimg (MIT-licensed) which uses libvips from https://github.com/jcupitt/libvips (LGPL v2.1+ -licensed). libvips is a C library and must be installed/built separately. See the github page for details. Also note that libvips in turn has dependencies with a selection of FOSS licenses. bimg and libvips have significantly better performance than nfnt/resize but produce slightly less-sharp images. bimg uses a box filter for downscaling to within about 200% of the target scale and then uses Lanczos3 for the last bit. This is a much faster approach but comes at the expense of sharpness. (~295ms in total for pre-generating 32x32-crop, 96x96-crop, 320x240-scale, 640x480-scale and 800x600-scale from a given JPEG image on a given machine.) diff --git a/scripts/build-test-lint.sh b/scripts/build-test-lint.sh index 96c75137..d2b2b4b1 100755 --- a/scripts/build-test-lint.sh +++ b/scripts/build-test-lint.sh @@ -4,13 +4,10 @@ set -eu -echo "Checking that it builds" -gb build - # Check that all the packages can build. # When `go build` is given multiple packages it won't output anything, and just # checks that everything builds. -echo "Double checking it builds..." +echo "Checking that it builds..." go build ./cmd/... ./scripts/find-lint.sh