Merge ~racb/git-ubuntu:nacc-breakdown/lxc-snap-env into git-ubuntu:master

Proposed by Robie Basak
Status: Superseded
Proposed branch: ~racb/git-ubuntu:nacc-breakdown/lxc-snap-env
Merge into: git-ubuntu:master
Diff against target: 55 lines (+21/-9)
1 file modified
gitubuntu/build.py (+21/-9)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Needs Fixing
Robie Basak Needs Information
Nish Aravamudan Pending
Review via email: mp+336297@code.launchpad.net

This proposal has been superseded by a proposal from 2018-01-20.

Commit message

Make Jenkins happy.

To post a comment you must log in.
Revision history for this message
Robie Basak (racb) wrote :

Why are we unsetting SNAP for some calls to lxc, but not all of them? Is there some criteria we have to use to decide this? Or are you just working around the calls that happen to break for now?

As long as we have to work around some other project's bug, I'd like to have a bug reference in a comment in our code which shows us why the workaround is present and what its status is for us to get rid of it. So when I asked for a bug against this, I meant I wanted an open bug task against the project which we are working around (whether that is snapd or lxd I'm not sure).

review: Needs Information
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

FAILED: Continuous integration, rev:c21e653eddde8b9ad7d4d89ee56ede9a4d504dc1
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~racb/usd-importer/+git/usd-importer/+merge/336297/+edit-commit-message

https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/246/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Style Check
    SUCCESS: Unit Tests
    SUCCESS: Integration Tests
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/246/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

FAILED: Continuous integration, rev:d16589b9f2835f9cf1cae6daf228447b343e7330
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~racb/usd-importer/+git/usd-importer/+merge/336297/+edit-commit-message

https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/250/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Style Check
    SUCCESS: Unit Tests
    SUCCESS: Integration Tests
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/250/rebuild

review: Needs Fixing (continuous-integration)

Unmerged commits

d16589b... by Nish Aravamudan

build: unset SNAP in lxc's env

Ever since lxc gained snap support, it assumed that if SNAP is set in
it's environment that lxc itself was running as a SNAP. This is not
necessarily the case when git-ubuntu itself is a classic snap (and thus
has SNAP set in its environment) but is calling lxc in the host. Unset
SNAP manually on lxc run() calls.

LP: #1741949

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/gitubuntu/build.py b/gitubuntu/build.py
2index 072d3e7..148d12d 100644
3--- a/gitubuntu/build.py
4+++ b/gitubuntu/build.py
5@@ -1029,14 +1029,26 @@ def do_build_lxd_exitstack(
6 "Failed to run apt in ephemeral build container"
7 )
8
9+ # lxd assumes that if SNAP is set in the environment, that it is
10+ # running as a snap. That is not necessarily true when git-ubuntu is
11+ # the snapped application. So unset SNAP before we exec.
12+ # LP: #1741949
13+ env_unset_SNAP = os.environ.copy()
14 try:
15- run([
16- lxc,
17- 'file',
18- 'push',
19- archive_tarball_name,
20- '%s/tmp/' % container_name,
21- ])
22+ del env_unset_SNAP['SNAP']
23+ except KeyError:
24+ pass
25+ try:
26+ run(
27+ [
28+ lxc,
29+ 'file',
30+ 'push',
31+ archive_tarball_name,
32+ '%s/tmp/' % container_name,
33+ ],
34+ env=env_unset_SNAP,
35+ )
36 except Exception as e:
37 raise RuntimeError(
38 "Failed to push archive tarball to ephemeral build container"
39@@ -1046,7 +1058,7 @@ def do_build_lxd_exitstack(
40 cmd.extend(tarballs)
41 cmd.extend(['%s/tmp/' % container_name,])
42 try:
43- run(cmd)
44+ run(cmd, env=env_unset_SNAP)
45 except Exception as e:
46 raise RuntimeError("Failed to push orig tarballs to container") from e
47
48@@ -1149,7 +1161,7 @@ def do_build_lxd_exitstack(
49 ]
50 )
51 cmd.extend([os.pardir,])
52- run(cmd)
53+ run(cmd, env=env_unset_SNAP)
54
55 return [os.path.join(os.pardir, f) for f in built_temp_contents]
56

Subscribers

People subscribed via source and target branches