Skip to content

Commit

Permalink
Add fpm to dev container image to avoid podman in docker in GitHub ac…
Browse files Browse the repository at this point in the history
…tions (#2012)

Summary: Add fpm to dev container image to avoid podman in docker in
GitHub actions

The production cli release build fails on these steps. The container
running the job is unable to create new namespaces and runs into the
following error:

```
+ podman run -i --rm -v /tmp/tmp.oCPtyljlYd:/src/ -v /__w/pixie/pixie:/image docker.io/cdrx/fpm-fedora:24 fpm -f -p /image/pixie-px-0.8.3.x86_64.rpm -s dir -t rpm -n pixie-px -v 0.8.3 --prefix /usr/local/bin px
time="2024-09-06T18:10:15Z" level=warning msg="\"/\" is not a shared mount, this could cause issues or missing mounts with rootless containers"
cannot clone: Operation not permitted
Error: cannot re-exec process
```

Rather than fix the namespace creation problem, which has been difficult
to debug, this installs the necessary tools within the container. This
will allow us to avoid using podman to run `fpm`.

This change also reverts the previous attempt at fixing this and removes
genny from the container image. See [this
comment](#2012 (comment))
for more details on the genny removal.

Relevant Issues: #1993

Type of change: /kind bugfix

Test Plan: Verified that building the deb and rpm packages works from
the ubuntu based dev container image and that installing the packages is
successful in their respective distros
```
$ docker run --entrypoint bash -it docker.io/ddelnano/dev_image:202409082304
root@f65d4d86e9be:/src# fpm -f -s dir -t rpm -n pixie-px -v 0.8.3 --prefix /usr/local/bin  -p pixie-px-0.8.3.x86_64.rpm px
Created package {:path=>"pixie-px-0.8.3.x86_64.rpm"}
root@f65d4d86e9be:/src# fpm -f -s dir -t deb -n pixie-px -v 0.8.3 --prefix /usr/local/bin  -p pixie-px-0.8.3.deb  px
Created package {:path=>"pixie-px-0.8.3.deb"}

# Install the rpm package and test px in a fedora container
$ docker run --entrypoint bash -it -v $(pwd):/src/ -w /src fedora
[root@90a53608bae0 src]# rpm -i pixie-px-0.8.3.x86_64.rpm
[root@90a53608bae0 src]# px --version
Pixie CLI
```
- Verified chef works against a Ubuntu noble VM
- [ ] Ran `#ci:ignore-deps` and `#ci:bpf-build-all-kernels` build due to
genny removal

---------

Signed-off-by: Dom Del Nano <[email protected]>
  • Loading branch information
ddelnano authored Sep 10, 2024
1 parent a4b8bc5 commit 07fff00
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 13 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/cli_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ jobs:
needs: get-dev-image
container:
image: ${{ needs.get-dev-image.outputs.image-with-tag }}
# --privileged is needed in order for podman to work. Otherwise it fails
# to create a new namespace when the clone syscall happens.
options: --privileged
env:
ARTIFACT_UPLOAD_LOG: "artifact_uploads.json"
steps:
Expand Down
8 changes: 4 additions & 4 deletions docker.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DOCKER_IMAGE_TAG=202405102250
LINTER_IMAGE_DIGEST=e9987c1c23d0d9c8443b3973f7f3482e5737b10053ce56f58fa59e4cb4f32291
DEV_IMAGE_DIGEST=7e38004cc30aa4f26b800ecad67c8e38fdffdfed8b3be0d3084e1706a60a4f21
DEV_IMAGE_WITH_EXTRAS_DIGEST=c405c9b28a8ed91785ad1115df146b80f275e88f93e4c5a516ad4bb7d4508112
DOCKER_IMAGE_TAG=202409092344
LINTER_IMAGE_DIGEST=18436897f607dd6b1926c12de13be7e9ed668a17cff133e4da90aad0112a406f
DEV_IMAGE_DIGEST=83eba02bf4ced64161276dee88dcd6f02de5951bb3ce5346a1182c70498156aa
DEV_IMAGE_WITH_EXTRAS_DIGEST=27ff4d9111b77516fdf73715ba6ea23d02de3b790d88f6f70a48c5e1ec53570c
2 changes: 1 addition & 1 deletion tools/chef/base_image_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
202405102217
202409092308
1 change: 0 additions & 1 deletion tools/chef/cookbooks/px_dev/recipes/golang.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
execute 'install go binaries' do
ENV['GOPATH'] = "/opt/px_dev/gopath"
command %(go install github.com/golang/mock/[email protected] && \
go install github.com/cheekybits/[email protected] && \
go install sigs.k8s.io/controller-tools/cmd/[email protected] && \
go install k8s.io/code-generator/cmd/[email protected] && \
go install github.com/go-bindata/go-bindata/[email protected]+incompatible && \
Expand Down
1 change: 1 addition & 0 deletions tools/chef/cookbooks/px_dev_extras/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

include_recipe 'px_dev_extras::mac_os_x'
include_recipe 'px_dev_extras::gperftools'
include_recipe 'px_dev_extras::packaging'

pkg_list = [
'cmake',
Expand Down
27 changes: 27 additions & 0 deletions tools/chef/cookbooks/px_dev_extras/recipes/packaging.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2018- The Pixie Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

# Packaging utilities only need to run on Linux
if node.platform_family?('debian')
apt_package ['ruby-dev', 'rpm'] do
action :upgrade
end

execute 'install_fpm' do
command '/usr/bin/gem install fpm'
action :run
end
end
2 changes: 1 addition & 1 deletion tools/chef/packer_docker_base.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"recipe[px_dev::linux]"
],
"type": "chef-solo",
"version": "18.4.12"
"version": "18.5.0"
},
{
"inline": [
Expand Down
2 changes: 1 addition & 1 deletion tools/chef/packer_docker_dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"recipe[px_dev::cleanup]"
],
"type": "chef-solo",
"version": "18.4.12"
"version": "18.5.0"
},
{
"inline": [
Expand Down
2 changes: 1 addition & 1 deletion tools/chef/packer_docker_dev_extras.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"recipe[px_dev_extras]"
],
"type": "chef-solo",
"version": "18.4.12"
"version": "18.5.0"
},
{
"inline": [
Expand Down
2 changes: 1 addition & 1 deletion tools/chef/packer_docker_linters.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"recipe[px_dev::cleanup]"
],
"type": "chef-solo",
"version": "18.4.12"
"version": "18.5.0"
},
{
"inline": [
Expand Down

0 comments on commit 07fff00

Please sign in to comment.