Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

Give different names to different flavors of stage1 images #1406

Merged
merged 5 commits into from Sep 24, 2015
Merged

Give different names to different flavors of stage1 images #1406

merged 5 commits into from Sep 24, 2015

Conversation

krnowak
Copy link
Collaborator

@krnowak krnowak commented Sep 15, 2015

This PR makes some small changes in rkt's behavior. Hopefully commit messages are quite clear about the changes.

In short - we do not default to stage1.aci in the same directory as rkt if default stage1 image path was not set; we always set the path. But the code tries to load the stage1 image from the same directory as rkt if loading stage1 image from default path fails.

This PR fixes #1292.

Using m4 defines in help strings makes them oddly formatted. I used
defines to avoid repeating some values, but:

1. They sometimes were used once anyway.
2. They don't change all that often, so a bit of redundancy should not
   be a problem.
This code is used not only by the run command, but also by prepare, so
let's move it outside. Also, it will grow in the next commit.
With this commit, each flavor of stage1 image has a different name,
basically in a pattern like "coreos.com/rkt/stage1-${flavor}". This
change also forced us to pass a default stage1 image path via a linker
flag unconditionally, because we cannot hardcode "stage1.aci".

This also makes some changes in the stage1 image loading:

1. If we want to use the default stage1 image we first check if it is
in the store. No change in this step.

2. If there was no default stage1 image in the store, we will try to
load it from disk. The change is that we will try one or two
locations:

  - if the default stage1 image path is an absolute path on disk, has
    a scheme (http://, docker://, etc) or it was overridden with
    --stage1-image flag, we will try to load it
  - if none of the above is true (so the path is relative), we ignore
    it
  - if the above fails (or is ignored) and the path has no scheme and
    it was not overridden, we try to load the image from the same
    directory where rkt resides using the basename of the default
    stage1 image path

Examples:

The default stage1 image path is set to
"/usr/libexec/rkt/stage1-lkvm.aci", the rkt binary is in
"/usr/bin". rkt will try to load "/usr/libexec/rkt/stage1-lkvm.aci"
first and if that fails, it will try to load
"/usr/bin/stage1-lkvm.aci".

In case where the default stage1 image path is set to
"some/relative/path/stage1-coreos.aci" rkt will only try to load
"/usr/bin/stage1-coreos.aci".

In case where the default stage1 image path is set to
"file:///dir/img.aci" or "https://example.com/img.aci", rkt will try
to load just that.

Loading different (non-default) stage1 image is unchanged.

This way we can have two things:

1. Having a working "rkt" installed with stage1 placed in different
directory (a groundwork for "make install").
2. The uninstalled case still works (provided that the stage1 image is
in the same directory as rkt as it was so far).

Fixes #1292
Just moving the code, no other changes here. The name will later
depend on a flavor.
We can build several src-flavored stage1 images with a different
systemd version from the same commit. Without this change all of those
images would have the same name and version. With the stage1 loading
optimization the other images would be ignored.

The filenames are still the same, though (stage1-src.aci).
@iaguis
Copy link
Member

iaguis commented Sep 16, 2015

LGTM

iaguis added a commit that referenced this pull request Sep 24, 2015
Give different names to different flavors of stage1 images
@iaguis iaguis merged commit 96c1089 into rkt:master Sep 24, 2015
@jonboulle
Copy link
Contributor

@iaguis @krnowak is there any UX change here we need to document?

@krnowak
Copy link
Collaborator Author

krnowak commented Sep 24, 2015

I don't think so. But it is late now, so I'll think about it tomorrow.

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

Successfully merging this pull request may close these issues.

Name stage1 differently for each flavor (filename and acName).
3 participants