Commit graph

9916 commits

Author SHA1 Message Date
Brad Warren
6094c1121b test snaps only 2020-07-22 16:27:56 -07:00
Erica Portnoy
8e783d026e Merge branch 'master' into plugin-stability 2020-07-22 16:13:39 -07:00
Adrien Ferrand
14dfbdbea5
Build snaps using the remote-build feature (#8153)
Snapcraft has a feature name `remote-build`. It allows to compile snaps using the Canonical dedicated build architecture for several architectures. Compared to the QEMU-enabled Docker approach used currently, the remote build has several advantages:
* the builds are done on the native architecture, making them basically faster than what can be achieved on QEMU
* it avoids to depend on `adferrand/snapcraft` (which could be otherwise be fixed with the merge of https://github.com/snapcore/snapcraft/pull/3144, but this will not happen in the short term)
* when everything is good, all snaps build can be run in parallel and then can be orchestrated by one single Azure Pipeline job, since the heavy tasks are done remotely.

This PR makes the necessary ajustements to use the remote build feature instead of the QEMU-enabled docker approach.

One complex task was to be able to compile the `certbot` snap on `arm64` and `armhf`. Indeed on these architectures the pre-compiled wheel for `cffi` is not available. So it needs to be compiled during the snap build. Sadly, the current version of the python plugin in snapcraft is limited by the fact that `wheels` is not installed in the virtual environment set up to build the python packages, and there is no easy way to change that except by overridding the whole build process.

In the long term, I think I will open a PR on `snapcraft` Git repository to provide a consistent solution. But for the short term, I used the possibility to provide arguments to the `venv` module, to add the flag `--system-site-packages`. With it, the virtual environment can use the system site package, where `wheel` is available.

The other significant additions are in `tools/snap/build_remote.py` script. If invoking the remote build on a local machine is quite straight-forward, it is another story on the CI because we need build auditability and resiliency during these non-interactive actions. In particular we should avoid as possible inconsistent results on the nightly pipeline and the release pipeline.

So this script wraps the `snapcraft` call into a retry logic, and improves its logs in the context of parallel builds.

For the minor modifications, it is mainly about ensuring that plugins can be built (some of them also need `cffi` for instance), and simplify the Azure Pipeline since all snaps are retrieved in one go.

Please note that the `test-` branches still run only the `amd64` architecture. Indeed I noticed that builds on `arm64` and `armhf` are tending to be very slow to start (up to 40 min) while the `amd64` ones wait at max 10 mins, and usually 30 seconds only when the overall load on Canonical side is low.

To work on `certbot/certbot` repository, one secured file needs to be added, because `snapcraft` needs to be authenticated against Launchpad with credentials allowing remote builds. To do so, from a local machine that have this capability, one can extract the existing file at `$HOME/.local/share/snapcraft/provider/launchpad/credentials`, and register it as a secured file in Azure Pipeline with the name `snapcraftRemoteBuildCredentials`.

* Define scripts

* Setup pipeline to use remote builds

* Focus on packaging builds

* Set credentials

* Setup git

* Launch all builds in parallel

* Add dev dependencies to build cffi and cryptography

* Convert to a python logic

* Reorganize the pipeline

* Handle the fact that snap builds may be taken from cache

* Generate constraints

* Exit code

* Check existence

* Try to handle better non zero exit code

* Add --system-site-packages to get wheel in the venv

* Add executable permissions

* Troubleshoot

* Dynamic display, take the maximum timeout for snap build job

* Allow retries if the remote build does not start

* Trigger only amd64 builds for test branches

* Exit properly

* Update snapcraft.yaml

* Fix snap run

* Set secured file name

* Update .azure-pipelines/templates/jobs/packaging-jobs.yml

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update .azure-pipelines/templates/jobs/packaging-jobs.yml

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update .azure-pipelines/templates/jobs/packaging-jobs.yml

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Move order in deps

* Reactivate all builds

* Use Manager() as a context manager

* Use Pool as a context manager

* Some nice refactorings

* Check snapcraft execution interruption with exit codes

* Use f-string and format expressions

* Start log

* Consistent use of single/double quotes

* Better loop to extract lines

* Retry on build failures

* Few optimizations

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2020-07-22 16:05:20 -07:00
Erica Portnoy
916d440938 Run tools/generate_dnsplugins_postrefreshhook.sh 2020-07-22 16:00:47 -07:00
Erica Portnoy
ab301c5f1d Update snap readme with new instructions 2020-07-22 16:00:09 -07:00
Erica Portnoy
b5fcd64661 small bash fixes 2020-07-22 15:57:27 -07:00
ohemorange
163ef93fb1
Update tools/generate_dnsplugins_postrefreshhook.sh
Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2020-07-22 15:54:56 -07:00
Erica Portnoy
a0a74cb558 remove trailing comma 2020-07-21 18:34:14 -07:00
Erica Portnoy
87a63c0d2c switch plug and slot names in integration test 2020-07-21 18:31:52 -07:00
Erica Portnoy
223ae53ad9 Merge branch 'master' into plugin-stability 2020-07-21 17:55:19 -07:00
Erica Portnoy
253d8d27de Check that refresh is allowed in integration test 2020-07-21 16:55:26 -07:00
Erica Portnoy
7a59f9077b Add packaging to install_requires 2020-07-21 16:50:41 -07:00
Erica Portnoy
dc38212e57 bin/sh comes first 2020-07-21 15:18:55 -07:00
Erica Portnoy
6b270e653b update snapcraft.yaml files for plugins 2020-07-21 15:08:32 -07:00
Erica Portnoy
6e9162c626 generate files using new script 2020-07-21 15:08:15 -07:00
Erica Portnoy
37fb365cfe Create post-refresh hook for all plugins with script 2020-07-21 15:05:48 -07:00
Erica Portnoy
be6505090f Add comment to generation file saying not to edit generated files manually 2020-07-21 15:05:30 -07:00
Erica Portnoy
fe838bbdac add plugin snap changes to generate script 2020-07-21 15:00:23 -07:00
Erica Portnoy
0db2e17daf import from setuptools._vendor 2020-07-21 14:36:46 -07:00
Erica Portnoy
63db51a7ee switch to requiring certbot version >= plugin version 2020-07-21 14:13:14 -07:00
Erica Portnoy
e3f12df03b switch to using packaging.version.parse instead of LooseVersion 2020-07-21 14:09:04 -07:00
Adrien Ferrand
270b5535e2
Add warnings about Python 3.5 deprecation in Certbot (#8154)
Fixes #8149

This PR adds warnings to warn about the incoming deprecation of Python 3.5 in Certbot.

* Add warnings about Python 3.5 deprecation in Certbot

* Update certbot/certbot/__init__.py

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2020-07-20 17:46:38 -07:00
Adrien Ferrand
74b0340a13
Use a specific tag of adferrand/snapcraft to build QEMU snaps and avoid failures (#8158)
The latest builds of snapcraft introduced somehow several failures when snaps are built on QEMU for armhf. See https://dev.azure.com/certbot/certbot/_build/results?buildId=2326&view=logs&j=7c548e18-6053-5a42-b366-e6480da09a69&t=a7c7ca26-ae0c-54e6-0355-3bfcd7bab03c for instance.

This PR uses a specific tags from `adferrand/snapcraft`, extracted from the last known working `nightly` pipeline, to avoid these failures until a more permanent fix is done. Very likely the fix will be the move to snapcraft remote builds.

* Use a specific tag of adferrand/snapcraft to build snaps and avoid an error on QEMU for armhf.

* Update tools/snap/build.sh

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

* Update tools/snap/build_dns.sh

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>

Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
2020-07-20 17:17:10 -07:00
Adrien Ferrand
b13dfc6437
Do not create the symlink for test assets on Windows if the asset path is already a symlink (#8159) 2020-07-21 01:01:09 +02:00
schoen
c5bab9b07c
Merge pull request #8157 from stefantalpalaru/linodedns
certbot_dns_linode: decrease the default propagation interval
2020-07-20 13:22:18 -07:00
Ștefan Talpalaru
b6964cae2e
certbot_dns_linode: decrease the default propagation interval
«When you add or change DNS zones or records, your changes will now be
reflected at our authoritative nameservers in under 60 seconds. This is
down from the previous “every quarter hour” approach that we had for so
long.» - https://www.linode.com/blog/linode/linode-turns-17/
2020-07-19 16:44:37 +02:00
Brad Warren
ebf1349b15
Update to IPython with Python 3.8 support. (#8152) 2020-07-17 13:01:04 -07:00
Brad Warren
9d2e0ac013
Specify the Certbot snap grade. (#8147) 2020-07-17 12:47:11 -07:00
Erica Portnoy
bbda2016ed use the correct filename 2020-07-16 15:06:08 -07:00
Erica Portnoy
fbd578f230 change presence test to new file 2020-07-16 14:58:14 -07:00
Erica Portnoy
4cbdfbad6f find and save certbot version on the certbot side 2020-07-16 14:44:32 -07:00
Erica Portnoy
1825833325 use sys.exit instead of exit 2020-07-16 14:31:37 -07:00
Erica Portnoy
4a3f306259 s/certbot-version/certbot-metadata/g 2020-07-16 14:29:05 -07:00
Thomas
05dbda4b51
added inwx plugin (#8115)
* added inwx plugin

* Update using.rst

fixed convention naming
2020-07-15 13:41:15 -07:00
Erica Portnoy
067ea6b88e Remove unnecessary yaml 2020-07-14 18:50:01 -07:00
Erica Portnoy
6871378f93 consolidate parts and remove more test code 2020-07-14 18:38:09 -07:00
Erica Portnoy
d4412c45c8 remove spaces for clarity 2020-07-14 18:35:58 -07:00
Erica Portnoy
3635527ea3 Remove debug script 2020-07-14 18:35:26 -07:00
Erica Portnoy
632574c607 Merge branch 'master' into plugin-stability 2020-07-14 18:34:04 -07:00
Erica Portnoy
137b5f0e01 remove some debugging code 2020-07-14 18:33:31 -07:00
Erica Portnoy
2bbbc78e8b improve bash syntax 2020-07-14 18:29:33 -07:00
Erica Portnoy
4f02b366f0 we need different prints for if we succeed or if we fail. 2020-07-14 18:10:38 -07:00
Erica Portnoy
324c4539cd it's python3 2020-07-14 17:59:23 -07:00
Erica Portnoy
1270b937c3 try comparing version numbers in python 2020-07-14 17:57:10 -07:00
Erica Portnoy
f5bb7fa34a update mkdir so we don't have to clean each time 2020-07-13 19:32:19 -07:00
Erica Portnoy
3d0935e395 pre-refresh hook is not necessary to get certbot version 2020-07-13 19:29:42 -07:00
Erica Portnoy
4cc0390b38 check if certbot version will be available post-refresh after all 2020-07-13 19:26:43 -07:00
Erica Portnoy
6bde33f707 remove unnecessary extra check, just check if the init file is available 2020-07-13 19:20:34 -07:00
Erica Portnoy
04238e050b why does echo need two >s 2020-07-13 19:11:29 -07:00
Erica Portnoy
2351260d1d ok NOW all print statements are going to the log 2020-07-13 19:04:06 -07:00