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

Initial how to build info and Make targets #107

Merged
merged 2 commits into from
Jun 21, 2018

Conversation

ashcrow
Copy link
Member

@ashcrow ashcrow commented Jun 15, 2018

A question has come up over how one would build RHCOS. The original Container Linux has this document explaining how to do so. Today the closest we have is for one to look at Jenkinsfile.*s.

This would let people run one or more make targets locally to build a local development version of RHCOS.

See #108

@ashcrow ashcrow added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/documentation Categorizes issue or PR as related to documentation. labels Jun 15, 2018
@ashcrow ashcrow requested review from lucab and jlebon June 15, 2018 13:52
@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 15, 2018
- ostree
- rpm-ostree
- imagefactory-plugins-TinMan
- qemu-img
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, might be worth inlining these requires into the building steps. That way if one just wants to know how to compose an OSTree, they don't need to install e.g. imgfac (which pulls in libvirt + systemd).

Copy link
Contributor

Choose a reason for hiding this comment

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

Offline suggestion: link the exotic tools to their repo (or, if they have it, to their "how to install" doc).

Copy link
Member

Choose a reason for hiding this comment

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

Most of this is yum -y install, with a few exceptions, those we should call out.

- ``ostree --repo=repo remote add rhcos --no-gpg-verify ${OSTREE_INSTALL_URL}``
- ``ostree --repo=repo pull --mirror --commit-metadata-only rhcos``
- ``imagefactory --debug base_image --file-parameter install_script cloud.ks --parameter offline_icicle True rhcos.tdl``
- ``export IMAGE=`ls /var/lib/imagefactory/storage/*.body```
Copy link
Member

Choose a reason for hiding this comment

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

Oh neat! I didn't know that you could use double ticks on the outside to safely use single ticks ` inside them!

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure you can 😆

@@ -1,3 +1,39 @@
# Operating System
Copy link
Member

Choose a reason for hiding this comment

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

I run basically all of this from a container, and so does the pipeline (except for Imagefactory for bad reasons). I think we should recommend that as well; it's mentioned below for the rpm-ostree bits. In fact we could just recommend pulling quay.io/cgwalters/coreos-assembler and running things in there right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Switched coreos-assembler to use podman

- ostree
- rpm-ostree
- imagefactory-plugins-TinMan
- qemu-img
Copy link
Member

Choose a reason for hiding this comment

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

Most of this is yum -y install, with a few exceptions, those we should call out.

- ``rpmdistro-gitoverlay build``
- Make the ostree
- ``export REPO=/tmp/repo``
- ``ostree init --repo=$REPO --mode=archive --src $REPO/ --dest=$REPO``
Copy link
Member

Choose a reason for hiding this comment

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

These --src/--dest args seem like a copy/paste error from rsync?

Copy link
Member Author

Choose a reason for hiding this comment

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

I actually wasn't 100% sure the right way to convert these lines from the Jenkinsfile without actually going through and testing out to see what happens.

Copy link
Member

Choose a reason for hiding this comment

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

It doesn't look like --src $REPO/ --dest=$REPO was dropped, definitely should be.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's now removed

- ``export REPO=/tmp/repo``
- ``ostree init --repo=$REPO --mode=archive --src $REPO/ --dest=$REPO``
- ``coreos-assembler --repo=$REPO host.yaml``
- ``ostree summary --repo=$REPO --update --dest $REPO/ --src=$REPO``
Copy link
Member

Choose a reason for hiding this comment

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

Ditto.

- Make the ostree
- ``export REPO=/tmp/repo``
- ``ostree init --repo=$REPO --mode=archive --src $REPO/ --dest=$REPO``
- ``coreos-assembler --repo=$REPO host.yaml``
Copy link
Member

Choose a reason for hiding this comment

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

rpm-ostree from git master supports the yaml...but this is OK for now.

- Make the qcow2
- ``ostree --repo=repo remote add rhcos --no-gpg-verify ${OSTREE_INSTALL_URL}``
- ``ostree --repo=repo pull --mirror --commit-metadata-only rhcos``
- ``imagefactory --debug base_image --file-parameter install_script cloud.ks --parameter offline_icicle True rhcos.tdl``
Copy link
Member

Choose a reason for hiding this comment

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

This is missing two seds for subbing out OSTREE_INSTALL_URL and OSTREE_INSTALL_REF. Though we can probably hardcode the latter at least now. (It was originally written to be usable for both CentOS and RHEL-derived input).


- git
- coreos-assembler
- rpmdistro-gitoverlay
Copy link
Contributor

Choose a reason for hiding this comment

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

This additionally requires fedpkg and mock.

@ashcrow
Copy link
Member Author

ashcrow commented Jun 18, 2018

Updates based on feedback.

@ashcrow ashcrow force-pushed the build-docs branch 3 times, most recently from 963931a to 77b7e5e Compare June 18, 2018 14:54
- ``export REPO=/tmp/repo``
- ``ostree init --repo=$REPO --mode=archive``
- ``podman run --privileged --rm -v $REPO:/srv quay.io/cgwalters/coreos-assembler``
- ``cd /srv && coreos-assembler --repo=/srv --cachedir=cache host.yml``
Copy link
Member

Choose a reason for hiding this comment

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

I used the coreos-assembler container to run all the commands up to here (including the rdgo ones).

If you follow the steps verbatim, the coreos-assembler command will fall over because there is no openshift.repo file available in openshift/os

I was able to generate the openshift.repo with the generate-openshift-repo command in the openshift/os repo, but then we fall over due to missing the Red Hat GPG key.

So I propose that the additional steps of:

  1. running generate-openshift-repo
  2. copying the Red Hat GPG key into /etc/pki/rpm-gpg/

...then running the coreos-assembler command.

(It might also be worth noting separately that the coreos-assembler command is not going to work unless you have access to the Red Hat stage CDN, just to dissuade anyone who is curious)

Copy link
Contributor

Choose a reason for hiding this comment

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

I was also going through the steps, and hit the same. For the former there seems to be already a make repo-refresh (similarly for init). For the latter I'm confused because it seems to bail on a gpgcheck=0 repo; is there a way to hook repo configs to relative paths from this git-repo?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, we can.

- mock

### May need to be built from source
- [coreos-assembler](https://github.com/cgwalters/coreos-assembler/): [container](http://quay.io/cgwalters/coreos-assembler)
Copy link
Member

Choose a reason for hiding this comment

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

Note #119 should make this unnecessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

Is coreos-assembler deprecated at this point as well?

@cgwalters
Copy link
Member

I'm fine merging this as is, it doesn't need to be perfect, and will clearly change over time.

@ashcrow
Copy link
Member Author

ashcrow commented Jun 19, 2018

@cgwalters I agree it doesn't have to be perfect. However, I'm going to turn these commands into make targets, and update this doc. At that point I'd like to have it re-reviewed for merging.

@ashcrow
Copy link
Member Author

ashcrow commented Jun 19, 2018

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 19, 2018
@ashcrow
Copy link
Member Author

ashcrow commented Jun 19, 2018

Updated with make targets. I don't think it's quite ready to merge but close. Questions:

  • Is there a default for OSTREE_INSTALL_URL?
  • What about INSTALLER_TREE_URL?
  • Is this needed?

@lucab @jlebon @cgwalters @miabbott PTAL

@ashcrow
Copy link
Member Author

ashcrow commented Jun 19, 2018

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 19, 2018
@ashcrow ashcrow changed the title README-development.md: Initial how to build info Initial how to build info and Make targets Jun 19, 2018
@miabbott
Copy link
Member

@ashcrow OSTREE_INSTALL_URL and INSTALLER_TREE_URL are sourced from the pipeline-utils.groovy file.

See here: https://github.com/openshift/os/blob/master/pipeline-utils.groovy#L52

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.

This is cool, though it's missing the "linking" between each target. E.g. ideally make rpmostree-compose would pick up the RPMs we just created with make rdgo, and similarly, make os-image would point to the OSTree repo.

I think that's something we could do later though. At least we have the basic targets that codify what each step entails.

Makefile Outdated
@@ -3,6 +3,10 @@ COMPOSEFLAGS ?=
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
CACHE_ARGS := $(shell if test -d cache; then echo $(shell pwd)/cache; fi)

REPO ?= /tmp/repo
Copy link
Member

Choose a reason for hiding this comment

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

How about something like /srv/rhcos/repo?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. Will update.

- ``export IMAGE=`ls /var/lib/imagefactory/storage/*.body```
- ``qemu-img convert -f raw -O qcow2 $IMAGE rhcos-devel.qcow2``
- Build packages from source repos: ``make rdgo``
- Make the ostree: ``OSTREE_INSTALL_URL=<OSTREE_INSTALL_URL_HERE> make rpmostree-compose``
Copy link
Member

Choose a reason for hiding this comment

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

Minor: I think the more standard way of setting vars when calling make is make <target> VAR1=val1 VAR2=val2....

@jlebon
Copy link
Member

jlebon commented Jun 19, 2018

INSTALLER_TREE_URL will use the Fedora installer tree by default, so it doesn't need to be subbed out (though it'd be much faster if pointed at a local mirror). OSTREE_INSTALL_URL... I guess we can hardcode for now the URL to the internal repo?

@miabbott
Copy link
Member

The ostree init on line 59 will silently no-op if the repo is already initialized.

@ashcrow
Copy link
Member Author

ashcrow commented Jun 19, 2018

@miabbott Are you thinking that we should add that directory to the clean target to ensure it does not exist?

@miabbott
Copy link
Member

@ashcrow It would probably make sense in terms of keeping things tidy.

@ashcrow
Copy link
Member Author

ashcrow commented Jun 19, 2018

@miabbott @jlebon updated

.PHONY: os-image
os-image:
ostree --repo=repo remote add rhcos --no-gpg-verify ${OSTREE_INSTALL_URL}
ostree --repo=repo pull --mirror --commit-metadata-only rhcos
Copy link
Member

Choose a reason for hiding this comment

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

Hmm...I think if you're doing local builds you want to be using the local ostree repo. That's what I do.

The annoying pain point is it requires setting up a webserver. See projectatomic/rpm-ostree-toolbox#68 and there's other PRs/issues around this too.

@cgwalters
Copy link
Member

A high level question here too is how much of this flow should live in https://github.com/cgwalters/coreos-assembler

I think having an opinionated container makes sense (versus delivering as an RPM as rpm-ostree-toolbox did).

Anyways...I'm OK to merge this as is too. Trying to change the Jenkinsfiles is going to be a whole other world.

- ``export IMAGE=`ls /var/lib/imagefactory/storage/*.body```
- ``qemu-img convert -f raw -O qcow2 $IMAGE rhcos-devel.qcow2``
- Build packages from source repos: ``make rdgo``
- Make the ostree: ``make rpmostree-compose OSTREE_INSTALL_URL=<OSTREE_INSTALL_URL_HERE> ``
Copy link
Member

Choose a reason for hiding this comment

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

I think this INSTALL_URL should be for make os-image right?

Copy link
Member

Choose a reason for hiding this comment

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

To be clear I'm OK to /lgtm after this small tweak, but up to you how much else you want to change.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated.

@ashcrow
Copy link
Member Author

ashcrow commented Jun 21, 2018

Updated

@cgwalters
Copy link
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 21, 2018
@openshift-merge-robot openshift-merge-robot merged commit d55750f into openshift:master Jun 21, 2018
@lucab
Copy link
Contributor

lucab commented Jul 9, 2018

I fear this has never been actually manually tried. There are a few gaps here and there (rpm-gpg assets, no valid OSTREE_INSTALL_URL default, mis-anchored paths in Makefile) which means that zero-knowledge onboarding here is still not a reality.

@ashcrow
Copy link
Member Author

ashcrow commented Jul 9, 2018

@lucab you are correct. There is work that needs to happen before someone who didn't actively work on the Jenkinsfiles and work on the underlying infrastructure can follow and recreate what's going on. There is also a side thing @cgwalters is doing in terms of changing the pipeline which may change some things.

Unfortunately I don't think we will be able to really finish #108 until the pipeline relaxes in flux once again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/documentation Categorizes issue or PR as related to documentation. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants