Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upload-oscontainer: New command #1107

Merged
merged 1 commit into from
May 5, 2020

Conversation

cgwalters
Copy link
Member

This code lives today in the RHCOS pipeline (internal gitlab);
to be honest, I have no idea why only the "core" oscontainer bits
ended up in cosa upstream and the script lived downstream.

Let's fix that, moving all of the logic here. Prep for
further work.

@miabbott
Copy link
Member

miabbott commented Feb 7, 2020

@miabbott
Copy link
Member

miabbott commented Feb 7, 2020

I needed $ chmod +x src/cmd-upload-oscontainer too

@cgwalters
Copy link
Member Author

OK, fixed those two bits plus some pylint stuff.

@miabbott
Copy link
Member

miabbott commented Feb 7, 2020

The use of buildah unshare got me building the oscontainer from within a cosa container, but it ultimately bombed out trying to podman inspect:

$ coreos-assembler oscontainer build --from scratch /srv/tmp/repo f8d0d218ddec8c1eeb830975fe9c8524a62df4e192724cdff450ad6e33fb5347 miabbott-rhcos:latest
Config commit: v3.1-755-g966e8841e8f9b32586306f7719efe727a3446007
Using manifest: /srv/src/config/manifest.yaml
Copying ostree commit into container: f8d0d218ddec8c1eeb830975fe9c8524a62df4e192724cdff450ad6e33fb5347 ...
+ ostree --repo=/home/builder/.local/share/containers/storage/overlay/6e3e54178ce0d391a0648e00402d8e3a06822dce11f745c088e791743fea8f31/merged/srv/repo pull-local /srv/tmp/repo f8d0d218ddec8c1eeb830975fe9c8524a62df4e192724cdff450ad6e33fb5347
3147 metadata, 20330 content objects imported                                                                                                                                                                        
+ buildah config --entrypoint [\"/noentry\"] -l com.coreos.ostree-commit=f8d0d218ddec8c1eeb830975fe9c8524a62df4e192724cdff450ad6e33fb5347 -l version=44.81.202002052139-0 working-container
Committing container...
Getting image source signatures
Copying blob b8e8ff90fcda done
Copying config 69d4ddd6d6 done
Writing manifest to image destination
Storing signatures
miabbott-rhcos:latest 69d4ddd6d6c9e1ce38c1513ed2781b29d611802457e6a1ae91c66a2cef3e056c
Error: stat /sys/fs/cgroup/systemd/user.slice/user-1000.slice/[email protected]/dbus\x2d:1.2\x2dcom.gexperts.Tilix.slice/dbus-:[email protected]/991546ce550afd3dcbac87f3487ead90e4c91a1417c03b0a055a759ef201b39e: no such file or directory
Traceback (most recent call last):
  File "/usr/lib/coreos-assembler/oscontainer.py", line 287, in <module>
    main()
  File "/usr/lib/coreos-assembler/oscontainer.py", line 283, in main
    authfile=args.authfile)
  File "/usr/lib/coreos-assembler/oscontainer.py", line 214, in oscontainer_build
    inspect = run_get_json(podman_base_argv + ['inspect', image_name_and_tag])[0]
  File "/usr/lib/coreos-assembler/oscontainer.py", line 54, in run_get_json
    return json.loads(subprocess.check_output(args))
  File "/usr/lib64/python3.7/subprocess.py", line 411, in check_output
    **kwargs).stdout
  File "/usr/lib64/python3.7/subprocess.py", line 512, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['podman', 'inspect', 'miabbott-rhcos:latest']' returned non-zero exit status 125.
ERRO exit status 1                                
ERRO exit status 1                                                            

The image was created, but it looks like podman is probing the wrong namespace?

$ ls -l /home/builder/.local/share/containers/storage/overlay-images/
total 12
drwx------. 2 builder builder 4096 Feb  7 15:17 69d4ddd6d6c9e1ce38c1513ed2781b29d611802457e6a1ae91c66a2cef3e056c
-rw-------. 1 builder builder 1592 Feb  7 15:17 images.json
-rw-------. 1 builder builder   64 Feb  7 15:17 images.lock
[coreos-assembler]$ jq '.[]["names"]' < /home/builder/.local/share/containers/storage/overlay-images/images.json 
[
  "localhost/miabbott-rhcos:latest"
]

It's further along than when I tried this recently, so still an improvement!

Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's kind of confusing the relationship between oscontainer and upload-oscontainer. Seems like we should just fold this into oscontainer? IOW, teach cmd-oscontainer about cosa metadata and just let it inject into meta.json?

Anyway, not opposed to doing that as a follow-up!

src/cmd-upload-oscontainer Outdated Show resolved Hide resolved
src/cmd-upload-oscontainer Outdated Show resolved Hide resolved
arithx pushed a commit to arithx/coreos-assembler that referenced this pull request Feb 7, 2020
```
Benjamin Gilbert (3):
      cmd/ore/aws: let list-regions list disabled regions, or all regions
      Merge pull request coreos#1102 from bgilbert/regions
      Merge pull request coreos#1104 from jcajka/bcrypt

Jakub Čajka (1):
      kola/tests/rpmostree: use NVR instead of NVRA

Jonathan Lebon (5):
      auth/aliyun: fix parsing config file
      Merge pull request coreos#1105 from jlebon/pr/aliyun-profile-fix
      ore/aliyun: add --delete-object and default to true
      platform/api/aliyun: sprinkle with some logging
      Merge pull request coreos#1107 from jlebon/pr/aliyun-delete-object
```
jcajka pushed a commit to jcajka/coreos-assembler that referenced this pull request Mar 24, 2020
ore/aliyun: add --delete-object and default to true
This code lives today in the RHCOS pipeline (internal gitlab);
to be honest, I have no idea why only the "core" oscontainer bits
ended up in cosa upstream and the script lived downstream.

Let's fix that, moving all of the logic here.  Prep for
further work.

Make this work a bit better too by automatically copying in
`~/.docker/config.json` into the supermin appliance, which is
something the RHCOS pipeline does.

And yes I hope to clean this all up more in the future but
for now let's get the code out of the darkness and into the light.
@cgwalters
Copy link
Member Author

OK rebased 🏄 and did an additional tweak to automatically copy in ~/.docker/config.json which makes this work out of the box in a dev container.

@jlebon
Copy link
Member

jlebon commented May 5, 2020

/lgtm

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cgwalters, jlebon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants