From 19f3de82797a48d9ff7bf3a66a502a2cfc001f1b Mon Sep 17 00:00:00 2001 From: Eleanor Deal Date: Wed, 22 Feb 2023 11:58:51 +0000 Subject: [PATCH 1/4] Add watchAll=false to prevent prompt on React tests from make --- volto/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/volto/Makefile b/volto/Makefile index adacf2c7..2816cbc4 100644 --- a/volto/Makefile +++ b/volto/Makefile @@ -15,7 +15,7 @@ build: .PHONY: test test: - yarn test + yarn test --watchAll=false .PHONY: debug debug: From 858666c7ab1ad9899ed5551408966e73d0a1b0aa Mon Sep 17 00:00:00 2001 From: Eleanor Deal Date: Thu, 23 Feb 2023 16:14:56 +0000 Subject: [PATCH 2/4] Add test target to plone makefile and update bootstrap to work again --- plone-5/Makefile | 5 +++++ plone-5/bootstrap.sh | 11 ++++++++--- plone-5/plone.md | 4 +++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/plone-5/Makefile b/plone-5/Makefile index 3ff6614d..bf4d4465 100644 --- a/plone-5/Makefile +++ b/plone-5/Makefile @@ -7,6 +7,11 @@ all: build build: docker build --build-arg POSTGRES_PASSWORD=$(POSTGRES_PASSWORD) --tag plone . +.PHONY: test +test: + ./bootstrap.sh develop.cfg + sudo ./instance/bin/test + .PHONY: debug debug: build docker run -p 8080:8080 plone \ No newline at end of file diff --git a/plone-5/bootstrap.sh b/plone-5/bootstrap.sh index 18ad1b9e..720415f4 100755 --- a/plone-5/bootstrap.sh +++ b/plone-5/bootstrap.sh @@ -18,7 +18,7 @@ if [[ "$OSTYPE" == "darwin"* ]]; then # and it doesn't find it without these env vars... ZLIB_BASE=$(brew --prefix zlib) export LDFLAGS="-L${ZLIB_BASE}/lib" - export CPPFLAGS="-I${ZLIB_BASE}/include" + export CPPFLAGS="-I${ZLIB_BASE}/include -Wno-error=implicit-function-declaration" else sed -i 's|var-dir=/data|var-dir=data|;/RelStorage\|psycopg2\|mysqlclient\|cx-Oracle\|ldap/d' instance/buildout.cfg fi @@ -35,7 +35,12 @@ export $(docker inspect --format='{{join .Config.Env " "}}' plone:${PLONE_VERSIO # restore my path variable export PATH=$mypath -pipenv install requests pip==$PIP setuptools==$SETUPTOOLS zc.buildout==$ZC_BUILDOUT wheel==$WHEEL +sudo pipenv install requests pip==$PIP setuptools==$SETUPTOOLS zc.buildout==$ZC_BUILDOUT wheel==$WHEEL cd instance -pipenv run buildout -c custom.cfg + +if [[ -z "$1" ]]; then + sudo pipenv run buildout -c custom.cfg +else + sudo pipenv run buildout -c $1 +fi cd .. diff --git a/plone-5/plone.md b/plone-5/plone.md index 97fc9ebf..de4206cf 100644 --- a/plone-5/plone.md +++ b/plone-5/plone.md @@ -33,7 +33,7 @@ brew install pipenv zlib libjpeg # zlib ZLIB_BASE=$(brew --prefix zlib) export LDFLAGS="-L${ZLIB_BASE}/lib" -export CPPFLAGS="-I${ZLIB_BASE}/include" +export CPPFLAGS="-I${ZLIB_BASE}/include -Wno-error=implicit-function-declaration" ``` ## 2. Bootstrap @@ -41,6 +41,8 @@ Docker is used to extract a baseline `buildout` config. Plone can be run in a Pi Finally, run `./bootstrap.sh` to create a local, virtualenv (Pipenv) separate environment with all the right dependencies fetched by `buildout` and placed into the `buildout-cache` directory. +Optionally, running `./bootstrap.sh ` with the name of another .cfg file will force the buildout stage to use that configuration. It uses `custom.cfg` by default, but `./bootstrap.sh develop.cfg` may be necessary to generate test scripts. + ## 3. Launch Once buildout completes, the `instance` directory will contain all necessary dependencies and scripts used to launch Plone. This can be launched directly: From 673c520231b1c76abca38b2ec389802cdfc21761 Mon Sep 17 00:00:00 2001 From: Eleanor Deal Date: Fri, 24 Feb 2023 10:05:29 +0000 Subject: [PATCH 3/4] Ensure volto make test target runs install first --- volto/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/volto/Makefile b/volto/Makefile index 2816cbc4..0de3a022 100644 --- a/volto/Makefile +++ b/volto/Makefile @@ -10,11 +10,11 @@ build: yarn build .PHONY: install -build: +install: yarn develop && yarn install .PHONY: test -test: +test: install yarn test --watchAll=false .PHONY: debug From 4de48f67197f08e66fc7c4921160318841cfb95c Mon Sep 17 00:00:00 2001 From: Eleanor Deal Date: Wed, 1 Mar 2023 18:07:08 +0000 Subject: [PATCH 4/4] Add volto audit target and move plone tests into new test docker image --- plone-5/.dockerignore | 2 ++ plone-5/Dockerfile.tests | 12 ++++++++++++ plone-5/Makefile | 4 ++-- volto/Makefile | 10 ++++++++-- 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 plone-5/Dockerfile.tests diff --git a/plone-5/.dockerignore b/plone-5/.dockerignore index 8a7040d8..6d33cbc8 100644 --- a/plone-5/.dockerignore +++ b/plone-5/.dockerignore @@ -1,7 +1,9 @@ * !zope.conf !instance/custom.cfg +!instance/develop.cfg !instance/src +!instance/bin !build-and-start.sh !instance/site.cfg instance/src/ukstats.ccv2.theme \ No newline at end of file diff --git a/plone-5/Dockerfile.tests b/plone-5/Dockerfile.tests new file mode 100644 index 00000000..1a706811 --- /dev/null +++ b/plone-5/Dockerfile.tests @@ -0,0 +1,12 @@ +FROM plone:5.2.7-python38 + +COPY instance/develop.cfg /plone/instance/ +COPY instance/src /plone/instance/src/ +RUN \ + sed -i '/mysqlclient\|cx-Oracle\|ldap/d' buildout.cfg && \ + buildout -c develop.cfg && \ + find /data -not -user plone -exec chown plone:plone {} \+ && \ + find /plone -not -user plone -exec chown plone:plone {} \+ + +WORKDIR /plone/instance +CMD ["./bin/test"] \ No newline at end of file diff --git a/plone-5/Makefile b/plone-5/Makefile index bf4d4465..44497236 100644 --- a/plone-5/Makefile +++ b/plone-5/Makefile @@ -9,8 +9,8 @@ build: .PHONY: test test: - ./bootstrap.sh develop.cfg - sudo ./instance/bin/test + docker build -t test-plone -f Dockerfile.tests . + docker run -it test-plone .PHONY: debug debug: build diff --git a/volto/Makefile b/volto/Makefile index 0de3a022..8d89c00e 100644 --- a/volto/Makefile +++ b/volto/Makefile @@ -3,7 +3,7 @@ SHELL=bash RAZZLE_PATH=http://localhost:8080/climate-change .PHONY: all -all: test build +all: audit test build .PHONY: build build: @@ -13,6 +13,12 @@ build: install: yarn develop && yarn install +# yarn audit will always return a non-zero exit code if +# any vulnerabilities are found regardless of severity +.PHONY: audit +audit: install + yarn audit --summary + .PHONY: test test: install yarn test --watchAll=false @@ -20,4 +26,4 @@ test: install .PHONY: debug debug: yarn run clean - RAZZLE_DEV_PROXY_API_PATH=$(RAZZLE_PATH) yarn start:dev \ No newline at end of file + RAZZLE_DEV_PROXY_API_PATH=$(RAZZLE_PATH) yarn start:dev