Merge ~chad.smith/ubuntu/+source/ubuntu-advantage-tools:release-27-impish into ubuntu/+source/ubuntu-advantage-tools:ubuntu/devel
- Git
- lp:~chad.smith/ubuntu/+source/ubuntu-advantage-tools
- release-27-impish
- Merge into ubuntu/devel
Status: | Merged |
---|---|
Approved by: | Bryce Harrington |
Approved revision: | 1ff489a64e18b06c0e10196c3fd49f61963d6f9f |
Merge reported by: | Chad Smith |
Merged at revision: | 4da4d2be0e2221686c0935cd9e9e521444af7b46 |
Proposed branch: | ~chad.smith/ubuntu/+source/ubuntu-advantage-tools:release-27-impish |
Merge into: | ubuntu/+source/ubuntu-advantage-tools:ubuntu/devel |
Diff against target: |
398 lines (+200/-5) (has conflicts) 10 files modified
.gitignore (+8/-0) Jenkinsfile (+16/-0) apt-hook/Makefile (+30/-0) apt-hook/json-hook-src/go.mod (+4/-0) apt-hook/json-hook-src/json-hook.go (+42/-0) apt-hook/json-hook-src/json-hook_test.go (+34/-0) debian/changelog (+20/-0) debian/control (+7/-0) debian/rules (+1/-0) uaclient/tests/test_util.py (+38/-5) Conflict in .gitignore Conflict in Jenkinsfile Conflict in apt-hook/Makefile Conflict in apt-hook/json-hook-src/go.mod Conflict in apt-hook/json-hook-src/json-hook.go Conflict in apt-hook/json-hook-src/json-hook_test.go Conflict in debian/changelog Conflict in debian/control Conflict in uaclient/tests/test_util.py |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Bryce Harrington (community) | Approve | ||
Grant Orndorff | Pending | ||
Lucas Albuquerque Medeiros de Moura | Pending | ||
Review via email: mp+401902@code.launchpad.net |
Commit message
Description of the change
Impish new upstream release of ubuntu-
This is a branch used only as a base for git-ubuntu release of 27.0 of uaclient. It brings all the functionality that we are going to release across ubuntu releases (xenial to hirsute) from our upstream branch https:/
To recreate this packaging branch:
#!/bin/bash
set -ex
git cherry-pick 140d0ee657d70e2
git cherry-pick 80b4172fa4dcac4
git cherry-pick e134dd489aed8ec
git cherry-pick 985f8d1eb74512c
git cherry-pick bad262200eb38d2
git cherry-pick c76dcf249adb6f3
git cherry-pick c6ceeedc536c714
git cherry-pick bb3d8928acd4ef7
# Grab all commits after release-27 branch started
git log b2de092ebeb9480
for commit in `tac commits`; do
echo $commit;
git cherry-pick $commit;
done
git log 906d3dfef24e409
for commit in `tac commits2`; do
echo $commit;
git cherry-pick $commit;
done
git show upstream/
git commit -m 'changelog' debian/changelog
Chad Smith (chad.smith) wrote : | # |
Chad Smith (chad.smith) wrote : | # |
Note that functional equivalent bits have been uploaded to https:/
Chad Smith (chad.smith) wrote : | # |
testing verification on this branch using the uaclient-staging-27 PPA above using Hirsute lxc because impish cloud-images not yet available.
$ cat > 27_test_setup.yaml <<EOF
#cloud-config
write_files:
- content: |
# Ubuntu-Advantage client config file.
contract_url: 'https:/
data_dir: /var/lib/
log_level: debug
log_file: /var/log/
features:
allow_beta: true
owner: root:root
path: /etc/ubuntu-
permissions: '0644'
apt:
sources:
ua_staging_ppa:
source: 'deb http://
keyid: 74E59E9E
packages: [ubuntu-
EOF
$ lxc launch ubuntu-
$ lxc exec test-27-h -- cloud-init status --wait --long # wait for pkg installs
status: done
time: Tue, 27 Apr 2021 21:56:38 +0000
detail:
DataSourceNoCloud [seed=/
$ lxc exec test-27-h -- ua version
27.0~21.04.1 +allow_beta
$ lxc exec test-27-h -- ua status # show unattached
SERVICE AVAILABLE DESCRIPTION
cc-eal no Common Criteria EAL2 Provisioning Packages
cis no Center for Internet Security Audit Tools
esm-apps no UA Apps: Extended Security Maintenance (ESM)
esm-infra no UA Infra: Extended Security Maintenance (ESM)
fips no NIST-certified FIPS modules
fips-updates no Uncertified security updates to FIPS modules
livepatch no Canonical Livepatch service
This machine is not attached to a UA subscription.
See https:/
# attach with token from https:/
$ lxc exec test-27-h -- ua attach <REDACTED>
This machine is now attached to '<email address hidden>'
SERVICE ENTITLED STATUS DESCRIPTION
cc-eal yes n/a Common Criteria EAL2 Provisioning Packages
cis yes n/a Center for Internet Security Audit Tools
esm-apps no — UA Apps: Extended Security Maintenance (ESM)
esm-infra yes n/a UA Infra: Extended Security Maintenance (ESM)
fips yes n/a NIST-certified FIPS modules
fips-updates yes n/a Uncertified security updates to FIPS modules
livepatch yes n/a Canonical Livepatch service
Enable services with: ua enable <service>
Account: <email address hidden>
Subscription: <email address hidden>
# Assert expected behavior enabling nothing (as there is no support on hirsute or impish)
$ lxc exec test-27-h -- ua enable esm-apps
One moment, checking your subscription first
This subscription is not entitled to UA Apps: ESM
For more information see: https:/
$ lxc exec test-27-h -- ua enable esm-infra
One moment, checking your subscription first
UA Infra: ESM is not available for Ubuntu 21.04 (Hirsute Hippo).
root@test-27-h:~# grep Traceback /var/log/
root@test-27-h:~#
Bryce Harrington (bryce) wrote : | # |
(same feedback from the hirsute mp)
Given that this is essentially a new upstream release, for review purposes I'm going to treat this as an upstream package merge. In other words, rather than a detailed code review I'm mainly going to focus on the packaging changes and integration testing, and assume the main codebase changes have been adequately reviewed and tested already. (The short timeframe we have really doesn't permit a full review anyway.)
However, I did do a cursory review through the 10 commits just to familiarize myself and make sure there's nothing scary. Didn't find anything notable, (other than that this impressively hits four different programming languages!)
I ran into a test failure on initial build which went away after subsequent builds. I'm ignoring that since I couldn't reproduce it, but am noting it in case it comes up again. The issue seemed to involve not recognizing one of the files in lib/ as a python module since there is not a lib/__init__.py. If that crops up anywhere else, it may need adjustment for how it imports the module.
Other than that, the build and test cases all worked fine, and the package installed and upgraded/downgraded without issue.
I did run into a problem trying to use the test case from the SRU bug to reproduce the issue. See
https:/
Since the SRU process isn't required for devel versions, I'll go ahead and mark this approved for impish and proceed with uploading.
Bryce Harrington (bryce) wrote : | # |
Tagged and uploaded for impish:
triage-
dpkg-buildpackage -us -uc -ui -i -I.bzr -I.svn -I.git -S
dpkg-buildpackage: info: source package ubuntu-
dpkg-buildpackage: info: source version 27.0
dpkg-buildpackage: info: source distribution impish
dpkg-buildpackage: info: source changed by Lucas Moura <email address hidden>
dpkg-source -i -I.bzr -I.svn -I.git --before-build .
debian/rules clean
dh clean --with python3,
dh: warning: Compatibility levels before 10 are deprecated (level 9 in use)
debian/rules override_
make[1]: Entering directory '/home/
dh_auto_clean
dh_auto_clean: warning: Compatibility levels before 10 are deprecated (level 9 in use)
pybuild --clean --test-pytest -i python{version} -p 3.9
I: pybuild base:232: python3.9 setup.py clean
running clean
removing '/home/
'build/
'build/scripts-3.9' does not exist -- can't clean it
rm -rf .pybuild/
find . -name \*.pyc -exec rm {} \;
make clean
make[2]: Entering directory '/home/
rm -f *.build *.buildinfo *.changes .coverage *.deb *.dsc *.tar.gz *.tar.xz
rm -rf *.egg-info/ .tox/ .cache/ .mypy_cache/
find . -type f -name '*.pyc' -delete
find . -type d -name '*__pycache__' -delete
make -C apt-hook clean
make[3]: Entering directory '/home/
rm -f hook ubuntu-
make[3]: Leaving directory '/home/
make[2]: Leaving directory '/home/
make[1]: Leaving directory '/home/
dh_clean -O--buildsystem
rm -f debian/
rm -rf debian/.debhelper/
dh_clean: warning: Compatibility levels before 10 are deprecated (level 9 in use)
rm -f debian/
rm -f -- debian/
rm -fr -- debian/
find . \( \( \
\( -path .\*/.git -o -path .\*/.svn -o -path .\*/.bzr -o -path .\*/.hg -o -path .\*/CVS -o -path .\*/.pc -o -path .\*/_darcs \) -prune -o -type f -a \
\( -name '#*#' -o -name '.*~' -o -name '*~' -o -name DEADJOE \
-o -name '*.orig' -o -name '*.rej' -o -name '*.bak' \
-o -name '.*.orig' -o -name .*.rej -o -name '.SUMS' \
-o -name TAGS -o \( -path '*/.deps/*' -a -name '*.P' \) \
\) -exec rm -f {} + \) -o \
\( -type d -a -name autom4te.cache -prune -exec rm -rf {} + \) \)
dpkg-source -i -I.bzr -I.svn -I.git -b ...
Bryce Harrington (bryce) wrote : | # |
I've uploaded the new 27.0.1 version with the above changes, to impish:
triage-
triage-
Enumerating objects: 17, done.
Counting objects: 100% (17/17), done.
Delta compression using up to 12 threads
Compressing objects: 100% (12/12), done.
Writing objects: 100% (12/12), 1.64 KiB | 559.00 KiB/s, done.
Total 12 (delta 7), reused 0 (delta 0), pack-reused 0
To ssh://git.
* [new tag] upload/27.0.1 -> upload/27.0.1
triage-
D: Setting host argument.
Checking signature on .changes
gpg: /home/bryce/
Checking signature on .dsc
gpg: /home/bryce/
Uploading to ubuntu (via ftp to upload.ubuntu.com):
Uploading ubuntu-
Uploading ubuntu-
Uploading ubuntu-
Uploading ubuntu-
Successfully uploaded packages.
- b32b476... by Grant Orndorff
-
apt-hook: refactor json hook messaging to be dry
The message construction code in the json hook
was pretty repetitive. This cleans it up a bit
and also removes some unnecessary explicit struct
names in the tests. - 4053b40... by Grant Orndorff
-
apt-hook: ignore go hook on some architectures
Golang doesn't support powerpc and riscv on older versions.
This configures our Build-Depends and Makefile to gracefully
handle scenarios where we can't build our go hook. We will
simply not ship the go hook in these limited scenarios.Fixes: #1603
- d32eef4... by Grant Orndorff
-
build: order build-depends alternatives newer first
When using alternatives in the Build-Depends section of
debian/control, we should always put the newer version of
a package first. This is because sbuild doesn't resolve
alternatives by default and we want sbuild to work on the
latest version of ubuntu with default settings.LP: #1926949
- f30579b... by Grant Orndorff
-
tests: fix subp ls error case
- 3bfe06c... by Chad Smith
-
changelog 27.0.1 & 27.0.2
- 4da4d2b... by Chad Smith
-
jenkinsfile: trusty sbuild --resolve-depends for CI runs
Chad Smith (chad.smith) wrote : | # |
Impish-proposed looks like it hasn't published officially. We also have SRU feedback on 27.0.1 that it breaks riscv64 package builds. So I think we need to close this branch and upload a 27.0.2 which will contain the right d/control magic and makefile conditionals to avoid packaging our go-based json hoook on those platforms without the golang support we need.
Preview Diff
1 | diff --git a/.gitignore b/.gitignore | |||
2 | index 2b2da67..29b86f4 100644 | |||
3 | --- a/.gitignore | |||
4 | +++ b/.gitignore | |||
5 | @@ -22,3 +22,11 @@ ubuntu_advantage_tools.dsc | |||
6 | 22 | # test/jenkins artifacts | 22 | # test/jenkins artifacts |
7 | 23 | pytest_results.xml | 23 | pytest_results.xml |
8 | 24 | reports/ | 24 | reports/ |
9 | 25 | <<<<<<< .gitignore | ||
10 | 26 | ======= | ||
11 | 27 | |||
12 | 28 | # apt-hook build artifacts | ||
13 | 29 | apt-hook/hook | ||
14 | 30 | apt-hook/ubuntu-advantage.pot | ||
15 | 31 | apt-hook/json-hook-src/json-hook | ||
16 | 32 | >>>>>>> .gitignore | ||
17 | diff --git a/Jenkinsfile b/Jenkinsfile | |||
18 | index 2082e19..925a9c3 100644 | |||
19 | --- a/Jenkinsfile | |||
20 | +++ b/Jenkinsfile | |||
21 | @@ -87,7 +87,11 @@ pipeline { | |||
22 | 87 | cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION} | 87 | cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION} |
23 | 88 | sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION} | 88 | sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION} |
24 | 89 | dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b . | 89 | dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b . |
25 | 90 | <<<<<<< Jenkinsfile | ||
26 | 90 | sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc | 91 | sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc |
27 | 92 | ======= | ||
28 | 93 | sbuild --resolve-alternatives --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc | ||
29 | 94 | >>>>>>> Jenkinsfile | ||
30 | 91 | cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb | 95 | cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb |
31 | 92 | cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb | 96 | cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb |
32 | 93 | ''' | 97 | ''' |
33 | @@ -108,7 +112,11 @@ pipeline { | |||
34 | 108 | cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION} | 112 | cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION} |
35 | 109 | sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION} | 113 | sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION} |
36 | 110 | dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b . | 114 | dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b . |
37 | 115 | <<<<<<< Jenkinsfile | ||
38 | 111 | sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc | 116 | sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc |
39 | 117 | ======= | ||
40 | 118 | sbuild --resolve-alternatives --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc | ||
41 | 119 | >>>>>>> Jenkinsfile | ||
42 | 112 | cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb | 120 | cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb |
43 | 113 | cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb | 121 | cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb |
44 | 114 | ''' | 122 | ''' |
45 | @@ -129,7 +137,11 @@ pipeline { | |||
46 | 129 | cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION} | 137 | cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION} |
47 | 130 | sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION} | 138 | sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION} |
48 | 131 | dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b . | 139 | dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b . |
49 | 140 | <<<<<<< Jenkinsfile | ||
50 | 132 | sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc | 141 | sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc |
51 | 142 | ======= | ||
52 | 143 | sbuild --resolve-alternatives --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc | ||
53 | 144 | >>>>>>> Jenkinsfile | ||
54 | 133 | cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb | 145 | cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb |
55 | 134 | cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb | 146 | cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb |
56 | 135 | ''' | 147 | ''' |
57 | @@ -150,7 +162,11 @@ pipeline { | |||
58 | 150 | cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION} | 162 | cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION} |
59 | 151 | sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION} | 163 | sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION} |
60 | 152 | dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b . | 164 | dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b . |
61 | 165 | <<<<<<< Jenkinsfile | ||
62 | 153 | sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc | 166 | sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc |
63 | 167 | ======= | ||
64 | 168 | sbuild --resolve-alternatives --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc | ||
65 | 169 | >>>>>>> Jenkinsfile | ||
66 | 154 | cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb | 170 | cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb |
67 | 155 | cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb | 171 | cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb |
68 | 156 | ''' | 172 | ''' |
69 | diff --git a/apt-hook/Makefile b/apt-hook/Makefile | |||
70 | index 15c4856..11294b1 100644 | |||
71 | --- a/apt-hook/Makefile | |||
72 | +++ b/apt-hook/Makefile | |||
73 | @@ -1,3 +1,21 @@ | |||
74 | 1 | # the go hook steps will be skipped if this is a nonempty string | ||
75 | 2 | SKIP_GO_HOOK = "" | ||
76 | 3 | |||
77 | 4 | GO_BIN = $(shell which go) | ||
78 | 5 | # Try go-1.14 and go-1.10 if not in path | ||
79 | 6 | ifeq ($(GO_BIN),) | ||
80 | 7 | ifneq ($(wildcard /usr/lib/go-1.14/bin/go),) | ||
81 | 8 | GO_BIN = /usr/lib/go-1.14/bin/go | ||
82 | 9 | else ifneq ($(wildcard /usr/lib/go-1.10/bin/go),) | ||
83 | 10 | GO_BIN = /usr/lib/go-1.10/bin/go | ||
84 | 11 | endif | ||
85 | 12 | endif | ||
86 | 13 | |||
87 | 14 | # If still not found then just don't build the go hook | ||
88 | 15 | ifeq ($(GO_BIN),) | ||
89 | 16 | SKIP_GO_HOOK = "1" | ||
90 | 17 | endif | ||
91 | 18 | |||
92 | 1 | all: build | 19 | all: build |
93 | 2 | 20 | ||
94 | 3 | build: hook ubuntu-advantage.pot json-hook | 21 | build: hook ubuntu-advantage.pot json-hook |
95 | @@ -9,15 +27,27 @@ hook: hook.cc | |||
96 | 9 | $(CXX) -Wall -Wextra -pedantic -std=c++11 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -g -o hook hook.cc -lapt-pkg $(LDLIBS) | 27 | $(CXX) -Wall -Wextra -pedantic -std=c++11 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -g -o hook hook.cc -lapt-pkg $(LDLIBS) |
97 | 10 | 28 | ||
98 | 11 | json-hook: | 29 | json-hook: |
99 | 30 | <<<<<<< apt-hook/Makefile | ||
100 | 12 | cd json-hook-src && GOCACHE=/tmp/ go build json-hook.go | 31 | cd json-hook-src && GOCACHE=/tmp/ go build json-hook.go |
101 | 32 | ======= | ||
102 | 33 | [ $(SKIP_GO_HOOK) ] || (cd json-hook-src && GOCACHE=/tmp/ $(GO_BIN) build json-hook.go) | ||
103 | 34 | >>>>>>> apt-hook/Makefile | ||
104 | 13 | 35 | ||
105 | 14 | install: hook json-hook | 36 | install: hook json-hook |
106 | 15 | install -D -m 644 20apt-esm-hook.conf $(DESTDIR)/etc/apt/apt.conf.d/20apt-esm-hook.conf | 37 | install -D -m 644 20apt-esm-hook.conf $(DESTDIR)/etc/apt/apt.conf.d/20apt-esm-hook.conf |
107 | 16 | install -D -m 755 hook $(DESTDIR)/usr/lib/ubuntu-advantage/apt-esm-hook | 38 | install -D -m 755 hook $(DESTDIR)/usr/lib/ubuntu-advantage/apt-esm-hook |
108 | 39 | <<<<<<< apt-hook/Makefile | ||
109 | 17 | install -D -m 755 json-hook-src/json-hook $(DESTDIR)/usr/lib/ubuntu-advantage/apt-esm-json-hook | 40 | install -D -m 755 json-hook-src/json-hook $(DESTDIR)/usr/lib/ubuntu-advantage/apt-esm-json-hook |
110 | 41 | ======= | ||
111 | 42 | [ $(SKIP_GO_HOOK) ] || install -D -m 755 json-hook-src/json-hook $(DESTDIR)/usr/lib/ubuntu-advantage/apt-esm-json-hook | ||
112 | 43 | >>>>>>> apt-hook/Makefile | ||
113 | 18 | 44 | ||
114 | 19 | clean: | 45 | clean: |
115 | 20 | rm -f hook ubuntu-advantage.pot json-hook-src/json-hook | 46 | rm -f hook ubuntu-advantage.pot json-hook-src/json-hook |
116 | 21 | 47 | ||
117 | 22 | test: | 48 | test: |
118 | 49 | <<<<<<< apt-hook/Makefile | ||
119 | 23 | cd json-hook-src && go test | 50 | cd json-hook-src && go test |
120 | 51 | ======= | ||
121 | 52 | [ $(SKIP_GO_HOOK) ] || (cd json-hook-src && GOCACHE=/tmp/ $(GO_BIN) test) | ||
122 | 53 | >>>>>>> apt-hook/Makefile | ||
123 | diff --git a/apt-hook/json-hook-src/go.mod b/apt-hook/json-hook-src/go.mod | |||
124 | index 66726af..2823e25 100644 | |||
125 | --- a/apt-hook/json-hook-src/go.mod | |||
126 | +++ b/apt-hook/json-hook-src/go.mod | |||
127 | @@ -1,3 +1,7 @@ | |||
128 | 1 | module json-hook | 1 | module json-hook |
129 | 2 | 2 | ||
130 | 3 | <<<<<<< apt-hook/json-hook-src/go.mod | ||
131 | 3 | go 1.2 | 4 | go 1.2 |
132 | 5 | ======= | ||
133 | 6 | go 1.7 | ||
134 | 7 | >>>>>>> apt-hook/json-hook-src/go.mod | ||
135 | diff --git a/apt-hook/json-hook-src/json-hook.go b/apt-hook/json-hook-src/json-hook.go | |||
136 | index 0f2e3eb..fc6b704 100644 | |||
137 | --- a/apt-hook/json-hook-src/json-hook.go | |||
138 | +++ b/apt-hook/json-hook-src/json-hook.go | |||
139 | @@ -45,6 +45,21 @@ type jsonRPC struct { | |||
140 | 45 | } `json:"params"` | 45 | } `json:"params"` |
141 | 46 | } | 46 | } |
142 | 47 | 47 | ||
143 | 48 | <<<<<<< apt-hook/json-hook-src/json-hook.go | ||
144 | 49 | ======= | ||
145 | 50 | func updatesFromSource(count int, source string, first bool) string { | ||
146 | 51 | security := "" | ||
147 | 52 | if first { | ||
148 | 53 | security = "security " | ||
149 | 54 | } | ||
150 | 55 | updates := "updates" | ||
151 | 56 | if count == 1 { | ||
152 | 57 | updates = "update" | ||
153 | 58 | } | ||
154 | 59 | return fmt.Sprintf("%d %s %s%s", count, source, security, updates) | ||
155 | 60 | } | ||
156 | 61 | |||
157 | 62 | >>>>>>> apt-hook/json-hook-src/json-hook.go | ||
158 | 48 | func createUpdateMessage(standardSecurityCount int, esmInfraCount int, esmAppsCount int) string { | 63 | func createUpdateMessage(standardSecurityCount int, esmInfraCount int, esmAppsCount int) string { |
159 | 49 | displayStandard := true | 64 | displayStandard := true |
160 | 50 | displayEsmInfra := true | 65 | displayEsmInfra := true |
161 | @@ -72,6 +87,7 @@ func createUpdateMessage(standardSecurityCount int, esmInfraCount int, esmAppsCo | |||
162 | 72 | } | 87 | } |
163 | 73 | 88 | ||
164 | 74 | standardUpdates := "" | 89 | standardUpdates := "" |
165 | 90 | <<<<<<< apt-hook/json-hook-src/json-hook.go | ||
166 | 75 | esmInfraUpdates := "" | 91 | esmInfraUpdates := "" |
167 | 76 | esmAppsUpdates := "" | 92 | esmAppsUpdates := "" |
168 | 77 | if displayStandard { | 93 | if displayStandard { |
169 | @@ -118,6 +134,32 @@ func createUpdateMessage(standardSecurityCount int, esmInfraCount int, esmAppsCo | |||
170 | 118 | } | 134 | } |
171 | 119 | 135 | ||
172 | 120 | return standardUpdates + esmInfraUpdates + esmAppsUpdates | 136 | return standardUpdates + esmInfraUpdates + esmAppsUpdates |
173 | 137 | ======= | ||
174 | 138 | afterStandard := "" | ||
175 | 139 | esmInfraUpdates := "" | ||
176 | 140 | afterInfra := "" | ||
177 | 141 | esmAppsUpdates := "" | ||
178 | 142 | |||
179 | 143 | if displayStandard { | ||
180 | 144 | standardUpdates = updatesFromSource(standardSecurityCount, "standard", true) | ||
181 | 145 | if displayEsmInfra && displayEsmApps { | ||
182 | 146 | afterStandard = ", " | ||
183 | 147 | } else if displayEsmInfra || displayEsmApps { | ||
184 | 148 | afterStandard = " and " | ||
185 | 149 | } | ||
186 | 150 | } | ||
187 | 151 | if displayEsmInfra { | ||
188 | 152 | esmInfraUpdates = updatesFromSource(esmInfraCount, "esm-infra", esmInfraFirst) | ||
189 | 153 | if displayEsmApps { | ||
190 | 154 | afterInfra = " and " | ||
191 | 155 | } | ||
192 | 156 | } | ||
193 | 157 | if displayEsmApps { | ||
194 | 158 | esmAppsUpdates = updatesFromSource(esmAppsCount, "esm-apps", esmAppsFirst) | ||
195 | 159 | } | ||
196 | 160 | |||
197 | 161 | return standardUpdates + afterStandard + esmInfraUpdates + afterInfra + esmAppsUpdates | ||
198 | 162 | >>>>>>> apt-hook/json-hook-src/json-hook.go | ||
199 | 121 | } | 163 | } |
200 | 122 | 164 | ||
201 | 123 | func fromOriginAndArchive(pkgVersion jsonRPCPackageVersion, origin string, archive string) bool { | 165 | func fromOriginAndArchive(pkgVersion jsonRPCPackageVersion, origin string, archive string) bool { |
202 | diff --git a/apt-hook/json-hook-src/json-hook_test.go b/apt-hook/json-hook-src/json-hook_test.go | |||
203 | index cfc1788..135ec2c 100644 | |||
204 | --- a/apt-hook/json-hook-src/json-hook_test.go | |||
205 | +++ b/apt-hook/json-hook-src/json-hook_test.go | |||
206 | @@ -14,6 +14,7 @@ func TestCreateUpdateMessages(t *testing.T) { | |||
207 | 14 | expectedMessage string | 14 | expectedMessage string |
208 | 15 | } | 15 | } |
209 | 16 | testParamsList := []params{ | 16 | testParamsList := []params{ |
210 | 17 | <<<<<<< apt-hook/json-hook-src/json-hook_test.go | ||
211 | 17 | params{0, 0, 0, ""}, | 18 | params{0, 0, 0, ""}, |
212 | 18 | params{0, 0, 1, "1 esm-apps security update"}, | 19 | params{0, 0, 1, "1 esm-apps security update"}, |
213 | 19 | params{0, 0, 2, "2 esm-apps security updates"}, | 20 | params{0, 0, 2, "2 esm-apps security updates"}, |
214 | @@ -41,6 +42,35 @@ func TestCreateUpdateMessages(t *testing.T) { | |||
215 | 41 | params{2, 2, 0, "2 standard security updates and 2 esm-infra updates"}, | 42 | params{2, 2, 0, "2 standard security updates and 2 esm-infra updates"}, |
216 | 42 | params{2, 2, 1, "2 standard security updates, 2 esm-infra updates and 1 esm-apps update"}, | 43 | params{2, 2, 1, "2 standard security updates, 2 esm-infra updates and 1 esm-apps update"}, |
217 | 43 | params{2, 2, 2, "2 standard security updates, 2 esm-infra updates and 2 esm-apps updates"}, | 44 | params{2, 2, 2, "2 standard security updates, 2 esm-infra updates and 2 esm-apps updates"}, |
218 | 45 | ======= | ||
219 | 46 | {0, 0, 0, ""}, | ||
220 | 47 | {0, 0, 1, "1 esm-apps security update"}, | ||
221 | 48 | {0, 0, 2, "2 esm-apps security updates"}, | ||
222 | 49 | {0, 1, 0, "1 esm-infra security update"}, | ||
223 | 50 | {0, 1, 1, "1 esm-infra security update and 1 esm-apps update"}, | ||
224 | 51 | {0, 1, 2, "1 esm-infra security update and 2 esm-apps updates"}, | ||
225 | 52 | {0, 2, 0, "2 esm-infra security updates"}, | ||
226 | 53 | {0, 2, 1, "2 esm-infra security updates and 1 esm-apps update"}, | ||
227 | 54 | {0, 2, 2, "2 esm-infra security updates and 2 esm-apps updates"}, | ||
228 | 55 | {1, 0, 0, "1 standard security update"}, | ||
229 | 56 | {1, 0, 1, "1 standard security update and 1 esm-apps update"}, | ||
230 | 57 | {1, 0, 2, "1 standard security update and 2 esm-apps updates"}, | ||
231 | 58 | {1, 1, 0, "1 standard security update and 1 esm-infra update"}, | ||
232 | 59 | {1, 1, 1, "1 standard security update, 1 esm-infra update and 1 esm-apps update"}, | ||
233 | 60 | {1, 1, 2, "1 standard security update, 1 esm-infra update and 2 esm-apps updates"}, | ||
234 | 61 | {1, 2, 0, "1 standard security update and 2 esm-infra updates"}, | ||
235 | 62 | {1, 2, 1, "1 standard security update, 2 esm-infra updates and 1 esm-apps update"}, | ||
236 | 63 | {1, 2, 2, "1 standard security update, 2 esm-infra updates and 2 esm-apps updates"}, | ||
237 | 64 | {2, 0, 0, "2 standard security updates"}, | ||
238 | 65 | {2, 0, 1, "2 standard security updates and 1 esm-apps update"}, | ||
239 | 66 | {2, 0, 2, "2 standard security updates and 2 esm-apps updates"}, | ||
240 | 67 | {2, 1, 0, "2 standard security updates and 1 esm-infra update"}, | ||
241 | 68 | {2, 1, 1, "2 standard security updates, 1 esm-infra update and 1 esm-apps update"}, | ||
242 | 69 | {2, 1, 2, "2 standard security updates, 1 esm-infra update and 2 esm-apps updates"}, | ||
243 | 70 | {2, 2, 0, "2 standard security updates and 2 esm-infra updates"}, | ||
244 | 71 | {2, 2, 1, "2 standard security updates, 2 esm-infra updates and 1 esm-apps update"}, | ||
245 | 72 | {2, 2, 2, "2 standard security updates, 2 esm-infra updates and 2 esm-apps updates"}, | ||
246 | 73 | >>>>>>> apt-hook/json-hook-src/json-hook_test.go | ||
247 | 44 | } | 74 | } |
248 | 45 | 75 | ||
249 | 46 | for i, testParams := range testParamsList { | 76 | for i, testParams := range testParamsList { |
250 | @@ -62,7 +92,11 @@ func TestCountSecurityUpdates(t *testing.T) { | |||
251 | 62 | expectedEsmAppsCount int | 92 | expectedEsmAppsCount int |
252 | 63 | } | 93 | } |
253 | 64 | testParamsList := []params{ | 94 | testParamsList := []params{ |
254 | 95 | <<<<<<< apt-hook/json-hook-src/json-hook_test.go | ||
255 | 65 | params{mockJson, 1, 2, 3}, | 96 | params{mockJson, 1, 2, 3}, |
256 | 97 | ======= | ||
257 | 98 | {mockJson, 1, 2, 3}, | ||
258 | 99 | >>>>>>> apt-hook/json-hook-src/json-hook_test.go | ||
259 | 66 | } | 100 | } |
260 | 67 | 101 | ||
261 | 68 | for i, testParams := range testParamsList { | 102 | for i, testParams := range testParamsList { |
262 | diff --git a/debian/changelog b/debian/changelog | |||
263 | index 9c6e17f..6a2d7e9 100644 | |||
264 | --- a/debian/changelog | |||
265 | +++ b/debian/changelog | |||
266 | @@ -1,3 +1,19 @@ | |||
267 | 1 | <<<<<<< debian/changelog | ||
268 | 2 | ======= | ||
269 | 3 | ubuntu-advantage-tools (27.0.2) impish; urgency=medium | ||
270 | 4 | |||
271 | 5 | * d/control: | ||
272 | 6 | - order build-depends alternatives newer first (LP: #1926949) | ||
273 | 7 | - apt-hook: do not attempt to package go APT JSON hook on some | ||
274 | 8 | architectures (GH: #1603) | ||
275 | 9 | * Bug-fix release 27.0.2: autopkg build failures on riscv64 and powerpc | ||
276 | 10 | - apt-hook: refactor json hook messaging to be dry | ||
277 | 11 | - tests: fix subp ls error case for powerpc builds | ||
278 | 12 | - jenkinsfile: add --resolve-alternatives for trusty builds | ||
279 | 13 | |||
280 | 14 | -- Chad Smith <chad.smith@canonical.com> Fri, 07 May 2021 11:58:03 -0600 | ||
281 | 15 | |||
282 | 16 | >>>>>>> debian/changelog | ||
283 | 1 | ubuntu-advantage-tools (27.0.1) impish; urgency=medium | 17 | ubuntu-advantage-tools (27.0.1) impish; urgency=medium |
284 | 2 | 18 | ||
285 | 3 | * Add .gitignore and cleanup ignored directory .pytest_cache | 19 | * Add .gitignore and cleanup ignored directory .pytest_cache |
286 | @@ -8,6 +24,10 @@ ubuntu-advantage-tools (27.0.1) impish; urgency=medium | |||
287 | 8 | ubuntu-advantage-tools (27.0) impish; urgency=medium | 24 | ubuntu-advantage-tools (27.0) impish; urgency=medium |
288 | 9 | 25 | ||
289 | 10 | * New upstream release 27.0: | 26 | * New upstream release 27.0: |
290 | 27 | <<<<<<< debian/changelog | ||
291 | 28 | ======= | ||
292 | 29 | - apt-hook: mitigate failures with true | ||
293 | 30 | >>>>>>> debian/changelog | ||
294 | 11 | - messages: add optional (s) to apt messaging to include | 31 | - messages: add optional (s) to apt messaging to include |
295 | 12 | singular/plural pkgs | 32 | singular/plural pkgs |
296 | 13 | - apt-hook: avoid reporting and counting duplicate package | 33 | - apt-hook: avoid reporting and counting duplicate package |
297 | diff --git a/debian/control b/debian/control | |||
298 | index cd28a1f..660a80d 100644 | |||
299 | --- a/debian/control | |||
300 | +++ b/debian/control | |||
301 | @@ -6,10 +6,17 @@ Build-Depends: bash-completion, | |||
302 | 6 | debhelper (>=9), | 6 | debhelper (>=9), |
303 | 7 | debianutils, | 7 | debianutils, |
304 | 8 | dh-python, | 8 | dh-python, |
305 | 9 | <<<<<<< debian/control | ||
306 | 9 | dh-systemd | debhelper (>= 13.3), | 10 | dh-systemd | debhelper (>= 13.3), |
307 | 10 | gettext, | 11 | gettext, |
308 | 11 | git, | 12 | git, |
309 | 12 | golang, | 13 | golang, |
310 | 14 | ======= | ||
311 | 15 | debhelper (>= 13.3) | dh-systemd, | ||
312 | 16 | gettext, | ||
313 | 17 | git, | ||
314 | 18 | golang-go (>= 2:1.14~) [!powerpc] | golang-1.14-go [!powerpc] | golang-1.10-go [!powerpc !riscv64], | ||
315 | 19 | >>>>>>> debian/control | ||
316 | 13 | libapt-pkg-dev, | 20 | libapt-pkg-dev, |
317 | 14 | po-debconf, | 21 | po-debconf, |
318 | 15 | python3 (>= 3.4), | 22 | python3 (>= 3.4), |
319 | diff --git a/debian/rules b/debian/rules | |||
320 | index 9bea522..57898f9 100755 | |||
321 | --- a/debian/rules | |||
322 | +++ b/debian/rules | |||
323 | @@ -27,6 +27,7 @@ override_dh_auto_build: | |||
324 | 27 | 27 | ||
325 | 28 | override_dh_auto_test: | 28 | override_dh_auto_test: |
326 | 29 | ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) | 29 | ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) |
327 | 30 | make -C apt-hook test | ||
328 | 30 | python3 -m pytest | 31 | python3 -m pytest |
329 | 31 | ifdef FLAKE8 | 32 | ifdef FLAKE8 |
330 | 32 | # required for Trusty: flake8 does not install a __main__ for -m | 33 | # required for Trusty: flake8 does not install a __main__ for -m |
331 | diff --git a/uaclient/tests/test_util.py b/uaclient/tests/test_util.py | |||
332 | index 019faf2..29a5bd2 100644 | |||
333 | --- a/uaclient/tests/test_util.py | |||
334 | +++ b/uaclient/tests/test_util.py | |||
335 | @@ -291,11 +291,12 @@ class TestSubp: | |||
336 | 291 | with pytest.raises(util.ProcessExecutionError) as excinfo: | 291 | with pytest.raises(util.ProcessExecutionError) as excinfo: |
337 | 292 | util.subp(["ls", "--bogus"]) | 292 | util.subp(["ls", "--bogus"]) |
338 | 293 | 293 | ||
344 | 294 | expected_error = ( | 294 | expected_errors = [ |
345 | 295 | "Failed running command 'ls --bogus' [exit(2)]." | 295 | "Failed running command 'ls --bogus' [exit(2)].", |
346 | 296 | " Message: ls: unrecognized option" | 296 | "ls: unrecognized option '--bogus'", |
347 | 297 | ) | 297 | ] |
348 | 298 | assert expected_error in str(excinfo.value) | 298 | for msg in expected_errors: |
349 | 299 | assert msg in str(excinfo.value) | ||
350 | 299 | assert 0 == m_sleep.call_count # no retries | 300 | assert 0 == m_sleep.call_count # no retries |
351 | 300 | 301 | ||
352 | 301 | @mock.patch("uaclient.util.time.sleep") | 302 | @mock.patch("uaclient.util.time.sleep") |
353 | @@ -795,6 +796,37 @@ class TestIsConfigValueTrue: | |||
354 | 795 | config=cfg.cfg, path_to_value="features.allow_beta" | 796 | config=cfg.cfg, path_to_value="features.allow_beta" |
355 | 796 | ) | 797 | ) |
356 | 797 | assert return_val == actual_val | 798 | assert return_val == actual_val |
357 | 799 | <<<<<<< uaclient/tests/test_util.py | ||
358 | 800 | |||
359 | 801 | @pytest.mark.parametrize( | ||
360 | 802 | "config_dict, key_val", | ||
361 | 803 | [ | ||
362 | 804 | ({"allow_beta": "tru"}, "tru"), | ||
363 | 805 | ({"allow_beta": "Tre"}, "Tre"), | ||
364 | 806 | ({"allow_beta": "flse"}, "flse"), | ||
365 | 807 | ({"allow_beta": "Fale"}, "Fale"), | ||
366 | 808 | ], | ||
367 | 809 | ) | ||
368 | 810 | def test_exception_is_config_value_true( | ||
369 | 811 | self, config_dict, key_val, FakeConfig | ||
370 | 812 | ): | ||
371 | 813 | path_to_value = "features.allow_beta" | ||
372 | 814 | cfg = FakeConfig() | ||
373 | 815 | cfg.override_features(config_dict) | ||
374 | 816 | with pytest.raises(exceptions.UserFacingError) as excinfo: | ||
375 | 817 | util.is_config_value_true( | ||
376 | 818 | config=cfg.cfg, path_to_value=path_to_value | ||
377 | 819 | ) | ||
378 | 820 | |||
379 | 821 | expected_msg = status.ERROR_INVALID_CONFIG_VALUE.format( | ||
380 | 822 | path_to_value=path_to_value, | ||
381 | 823 | expected_value="boolean string: true or false", | ||
382 | 824 | value=key_val, | ||
383 | 825 | ) | ||
384 | 826 | assert expected_msg == str(excinfo.value) | ||
385 | 827 | |||
386 | 828 | |||
387 | 829 | ======= | ||
388 | 798 | 830 | ||
389 | 799 | @pytest.mark.parametrize( | 831 | @pytest.mark.parametrize( |
390 | 800 | "config_dict, key_val", | 832 | "config_dict, key_val", |
391 | @@ -824,6 +856,7 @@ class TestIsConfigValueTrue: | |||
392 | 824 | assert expected_msg == str(excinfo.value) | 856 | assert expected_msg == str(excinfo.value) |
393 | 825 | 857 | ||
394 | 826 | 858 | ||
395 | 859 | >>>>>>> uaclient/tests/test_util.py | ||
396 | 827 | class TestRedactSensitiveLogs: | 860 | class TestRedactSensitiveLogs: |
397 | 828 | @pytest.mark.parametrize( | 861 | @pytest.mark.parametrize( |
398 | 829 | "raw_log,expected", | 862 | "raw_log,expected", |
Propr to release into impish we will follow most of our SRU exception guidelines for testing and verification on lxc. https:/ /wiki.ubuntu. com/UbuntuAdvan tageToolsUpdate s
To test:
Since most UA offerings don't actually exist on impish, there is not much to actively test.
Things we need to confirm:
1. the systemd services ua-reboot-cmds and timer ua-messaging are in good
shape and don't affect system boot via systemctl status.
systemctl list-timers --all | grep ua
systemctl status ua-reboot-cmds
2. /ubuntu. com/advantage
Performing ua attach continues to work attach the machine without error (this is only a minor upgrade for impish so shouldn't have degraded).
grab a token for your from https:/
sudo ua attach <your_TOKEN> ubuntu- advantage. log
sudo ua status
sudo grep Traceback /var/log/