Commit Graph

53 Commits

Author SHA1 Message Date
James Le Cuirot
9f8eac6540
Drop lots of obsolete release signing and upload code
Most of this hinges on the --upload option being passed, and it never is
any more. Much of it also uses Google Buckets, which we no longer use,
save for some GCE-specific bits.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
2024-11-26 14:58:24 +00:00
James Le Cuirot
44223cbbe0
Drop obsolete comments about how Catalyst stage 1 is built
Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
2024-08-01 13:31:57 +01:00
James Le Cuirot
7d85ee75da
Skip Catalyst stage2 as recommended by upstream Gentoo
From https://wiki.gentoo.org/wiki/Catalyst/Stage_Creation#Build_Stage3:

> It is not necessary to build stage2 in order to build stage3. Gentoo
> release engineering does not build stage2, and you should not need to
> unless you're intentionally building a stage2 as your goal.

We can now sync portage-stable/scripts with upstream because
bootstrap.sh is only used during stage2, and the changes we had are no
longer relevant. It seems likely the changes were already redundant
anyway.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
2024-08-01 13:31:56 +01:00
James Le Cuirot
872ea6d14d
Don't use repo snapshots for stage1 by updating seed the new way
This is what upstream Gentoo does. They would previously update the
entire seed, but this took a long time. Our seeds are much bigger, so we
kept repo snapshots to build stage1 against these instead. The new
method of only rebuilding packages with changed sub-slots is a good
compromise and removes the need to write stage1 hooks that selectively
catch the repository up.

This also avoids some conflicts by adding the `--ignore-world` option.
Gentoo seeds have nothing in @world. We have much more, but none of that
is needed for stage1.

This continues to exclude cross-*-cros-linux-gnu/* as that is not needed
for stage1. It now also excludes dev-lang/rust, because it is never a
DEPEND, so it would not break other packages in this way. It may fail to
run due to a sub-slot change in one of its own dependencies, but it is
also unlikely to be needed in stage1 and it is not configured to use the
system LLVM. If needs be, we could improve the behaviour of Portage's
@changed-subslot to respect `--with-bdeps`.

In my testing, it was unable to handle an SDK from 17 months ago, but
one from 7 months ago did work. In practise, we will always use a much
more recent one, which is far more likely to work.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
2024-07-15 14:28:03 +01:00
James Le Cuirot
1d7d53fad9
Upgrade to Catalyst 4
Catalyst 4 has totally changed the way repositories are handled. It only
works when the name of the directory containing the repository matches
the configured name of that repository. This was not the case for us,
with the coreos repository residing in the coreos-overlay directory. We
wanted to move and rename our repositories anyway, but this is a big
change, so we'll do separately. For now, this just renames coreos to
coreos-overlay.

Catalyst 4 also ingests the main repository snapshot as a squashfs
rather than a tarball. It features a utility to generate such a
snapshot, but it doesn't fit Flatcar well, particularly because it
expects each ebuild repository to reside at the top level of its own git
repository. It was very easy to call tar2sqfs manually though.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
2024-07-15 14:27:59 +01:00
Krzesimir Nowak
4a86bf9c83 bootstrap_sdk: Allow stage1 hooks to decide about updating seed SDK
Stage1 hooks will receive a path to a file as a third parameter. They
can use it to tell the bootstrap script to set up catalyst to perform
updates on seed SDK. Contents of the file are ignored - what counts is
that the file exists AND is not empty.
2024-05-23 11:19:30 +02:00
Krzesimir Nowak
60aded12f5 build_library/catalyst.sh: Fix and extend snapshot handling
- Fix the snapshot name, it is not "portage-${VERSION}", but rather
  "gentoo-${VERSION}".

- After building the snapshot, remove all the similar files from the
  snapshots directory - Catalyst gets easily confused by them and
  bails out.

- Extend the `build_snapshot` function to optionally accept the config
  path and the snapshot name, so SDK's stage1 code can use this
  function instead of duplicating parts of it.
2023-05-25 12:35:29 +02:00
Thilo Fromm
401af830d1 scripts, CI, workflows: remove submodule handling (main) 2023-04-13 12:26:36 +02:00
Krzesimir Nowak
74a5e5fcc5 bootstrap_sdk: Allow running hooks to modify stage1 repos
Sometimes the modification to stage1 repos is necessary. For example
we will need to update baselayout package in stage1, so we get the
cleaned up handling of PATH and ROOTPATH, which will allow a newer
portage to succeed in calculating dependencies in stage2.
2023-03-02 08:36:52 +01:00
Krzesimir Nowak
fa48f70a37 *: Make catalyst and emerge verbose by default
That way we can see a report of what emerge is going to do and the
status of the use flags for the installed packages. The downside is
that we are going to have reports about using deprecated and
unsupported profile in even more places.
2023-02-16 13:57:05 +01:00
Krzesimir Nowak
520b92ad7e *: Expand short emerge flags and use bash arrays
Emerge flags are cryptic in general, but short flags even more so, so
expand them. While at it, I noticed some places where bash arrays
could be used, so convert those places too.
2023-02-16 13:57:05 +01:00
Kai Lueke
91a26e5e1e Use new github org name "flatcar"
The "flatcar-linux" github org was renamed to "flatcar". There are no
github redirections in place and we have to update all links.
2022-09-14 14:33:27 +02:00
Thilo Fromm
f37df4230c
bootstrap_sdk: improve stage1 description
This change updates the documentation at the top of the script, calling out the limitations of stage1 (no stage isolation) early to avoid confusion.
2022-03-25 13:48:02 +01:00
Krzesimir Nowak
96b37b89f8 *: Replace kinvolk github org with flatcar-linux
Stop relying on github redirects, they are a mixed blessing and using
them broke emerge-gitclone inside dev-container in silent way. The
script could not find a desired revision of portage-stable or
coreos-overlay, because it tried to pull from kinvolk instead of
flatcar-linux github org. The redirects seem to hinder fetching a
specific commit, so the script pulled something else (HEAD or main?).
2021-12-21 17:22:48 +01:00
Dongsu Park
4d59b8715b bootstrap_sdk: skip uploading non-existent directory to fix Rust builds
Previously before https://github.com/kinvolk/flatcar-scripts/pull/134,
`bootstrap_sdk` was looking at the wrong path
(/usr/lib/rust-*/rustlib/aarch64-unknown-linux-gnu instead of
/usr/lib/rustlib/aarch64-unknown-linux-gnu). As a result, Rust got always
removed and rebuilt in `install_cross_rust`, which resulted in
`flatcar-sdk/crossdev/dev-lang/rust/rust-1.54.0-1.xpak` being created.

Now legitimate changes of https://github.com/kinvolk/flatcar-scripts/pull/134
prevent the rebuild from happening. The path already exists in a stage4
SDK build, because the seed stage already has cross-compilers so the
Rust upgrade has all the right cross-paths.

That's why SDK builds with only stage4 failed when it tries uploading Rust
packages like the following. On the other hand, full SDK builds with stage1
to 4 worked well, because in that case Rust is rebuilt anyway.

```
INFO    bootstrap_sdk: Uploading cross toolchain packages to
gs://flatcar-jenkins/developer/sdk/amd64/2021.08.04+dev-flatcar-master-3209
CommandException: No URLs matched:
/mnt/host/source/src/build/catalyst/packages/flatcar-sdk/crossdev/*
CommandException: No URLs matched:
/tmp/tmp.xyjXbCFhUc//mnt/host/source/src/build/catalyst/packages/flatcar-sdk/crossdev/*.sig
CommandException: 2 files/objects could not be transferred.
```

To fix that, we have to skip uploading packages when the crossdev
directory does not exist.

Debugged and suggested by @jepio
2021-08-10 12:18:58 +02:00
Jeremi Piotrowski
a8a57c733b
Merge pull request #134 from kinvolk/jepio/arm64-sdk-support
bootstrap_sdk: enable arm64 sdk bootstrap
2021-08-03 12:18:01 +02:00
Jeremi Piotrowski
e2c10a9fe8 bootstrap_sdk: override seed path after building stage1
When performing a full bootstrap (stage1-4), the stage1 results are currently
discarded because of the logic in catalyst_build: the first build stage uses
the "seed" and every following stage uses the previous stages results *but*
stage1 is built before catalyst_build. So from the point of view of
catalyst_build, stage2 is the first one and uses the seed tarball.

To make sure stage1 results are used if it was built, set the SEED variable to
the latest stage1 location.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2021-07-26 16:29:13 +00:00
Jeremi Piotrowski
e4f57bea82 bootstrap_sdk: fix issues around lib->lib64 symlink
The arm64 profiles don't specify SYMLINK_LIB=yes, which makes sense
since arm64 systems don't support multilib in the way that we are used
to from x86. What this means is that build artifacts are installed into
separate lib and lib64 directories. The root overlay installed in stage4
needs to check for SYMLINK_LIB before trying to create a symlink,
otherwise it fails to be applied because it collides with the directory
in the rootfs.

This uncovered a second minor issues - the rust toolchain bootstrap
scripts checked for /usr/lib64/rust*, but the ebuild installs to
/usr/lib/rust.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2021-07-19 15:11:09 +00:00
Thilo Fromm
8877d7adcd bootstrap_sdk: use local SDK ebuilds for stage1
This change uses portage-stable and coreos-overlay from the local SDK
chroot (from /var/lib/gentoo/repos) in the stage 1 SDK bootstrap build.
This is part 2 of the SDK bootstrap stage 1 fix (part 1 is covered in
64d8a73ac0), which ensures stage 1 does
not introduce any changes in its ebuilds over the seed SDK.

The change also introduces an option to consciously divert from the
above enforcement by use of command line parameters:

--stage1_overlay_ref <gitref> will check out coreos-overlay and use
                                <gitref> for stage 1 instead of the
                                local SDK's
                                /var/lib/gentoo/repos/coreos-overlay

--stage1_portage_ref <gitref> will check out portage-stable and use
                                <gitref> for stage 1 instead of the
                                local SDK's
                                /var/lib/gentoo/repos/gentoo

Signed-off-by: Thilo Fromm <thilo@kinvolk.io>
2021-04-23 16:23:03 +02:00
Thilo Fromm
659d4bf484
bootstrap_sdk: fix typo in top-level stage1 description
Co-authored-by: Sayan Chowdhury <sayan@kinvolk.io>
2021-03-05 12:11:18 +01:00
Thilo Fromm
ac31f8ac9a
bootstrap_sdk: fix typo in bootstrap process description
Co-authored-by: Marga Manterola <62987181+marga-kinvolk@users.noreply.github.com>
2021-03-04 19:03:00 +01:00
Thilo Fromm
319e3e702f bootstrap_sdk stage1: more comments, restructured for clarity
Signed-off-by: Thilo Fromm <thilo@kinvolk.io>
2021-03-04 18:07:54 +01:00
Thilo Fromm
9fd60f9ea2
Spelling fixes in comments
Co-authored-by: Krzesimir Nowak <krzesimir@kinvolk.io>
2021-03-04 11:33:30 +01:00
Thilo Fromm
84d7bf63b1 bootstrap_sdk: no package updates in stage 1
This change updates the stage1 SDK bootstrap build to use local
("known good") package ebuilds only, preventing updated package ebuilds
to apply in stage 1. This fixes SDK build breakage we observed when
upgrading core libraries like readline.

The change also removes the seed update from stage 1 as it should not
be needed anymore now that we postpone any package updates to stage 2.

The following package ebuild repos are used for stage 1:
- for portage-stable, we simply copy /var/gentoo/repos/gentoo
   from the SDK root.
- coreos-overlay is more complicated since ebuilds are missing from
   the SDK. So we grok the version the SDK was built with from
     /mnt/host/source/.repo/manifests/default.xml
   and then we create a local stage 1 clone of
     https://github.com/kinvolk/coreos-overlay.git
   in which we then check out the revision noted in the default mnifest.

Signed-off-by: Thilo Fromm <thilo@kinvolk.io>
2021-03-03 17:32:38 +01:00
Krzesimir Nowak
917d12cd7e bootstrap_sdk: The CONTENTS files are now gzipped
A newer version of catalyst seems to be actually gzipping the CONTENTS
files, so take this into accout.
2021-02-12 10:03:16 +01:00
Krzesimir Nowak
11d1e10e3f bootstrap_sdk: Put image, contents and digests paths into variables
It makes it a bit easier to read and clearer what the script is doing
without all that repetition.
2021-02-05 08:27:34 +01:00
Krzesimir Nowak
aab2cb5c77 bootstrap_sdk, build_toolchains: Move the ROOT_OVERLAY variable
ROOT_OVERLAY variable is defined in terms of TEMPDIR. The TEMPDIR
variable is set to an empty value by catalyst.sh, which the two
scripts import. So ROOT_OVERLAY always ended up being located in
toplevel directory (i.e. `/`). But the TEMPDIR variable gets a
meaningful value after calling the catalyst_init function, so define
the ROOT_OVERLAY after the function is called.
2021-02-03 17:16:02 +01:00
Marga Manterola
e04156a0f1
bootstrap_sdk: build and upload SDK toolchain pkgs
Before, we were relying on the toolchains job to build and upload
packages that were part of the SDK. With this change, all packages that
should be part of the SDK are built and uploaded by the SDK job. The
toolchains job only builds toolchain packages specific for the release.

This change includes several adjustments done to both the SDK and the
toolchains jobs to make this work:
 * Make the SDK job build all cross toolchains, including Rust
 * Stop building Rust in the toolchains job and use the one in the SDK
   instead.
 * In toolchain_util.sh: detect when the symlink folder for crossdev
   packages is missing and run crossdev to create it during
   update_chroot setup.
 * Make it possible to build the SDK starting from stage 4 instead of
   stage 1, to make the SDK building faster for PR branches / nightlies
   (full build should still be done for releases / weeklies).
2020-06-29 15:18:55 +05:30
Flatcar Buildbot
1dad511f69 2317.0.1 2019-11-07 19:40:01 +01:00
David Michael
3a24149f66 bootstrap_sdk: upload package signatures 2017-03-31 16:50:12 -07:00
Michael Marineau
3ff92f4bc3 bootstrap_sdk: use http instead of https
Using https gives us a bit of a dep issue, cannot download the sources
required to build ssl support when ssl hasn't been built yet!
2016-05-02 20:23:30 -07:00
Michael Marineau
5ba4c7181d *: drop usage of COREOS_VERSION_STRING
This variable was semi-deprecated ages ago so `version.txt` could follow
a similar variable naming pattern to `os-release`. Finally drop usage of
it here in favor of `$COREOS_VERSION`.
2016-02-15 13:55:55 -08:00
Michael Marineau
aa4ba8b2bb bootstrap_sdk: do not remove make.conf, turns out catalyst runs sed over it 2015-07-06 13:14:51 -07:00
Michael Marineau
db734ea417 bootstrap_sdk: do not leak catalyst config into sdk tarballs
The version of repos.conf/coreos.conf that catalyst needs isn't valid
for normal SDK chroots and causes env-update to spew errors when it is
run prior to update_chroot which configures portage properly.
2015-07-05 16:57:05 -07:00
Michael Marineau
5789c6bbbf bootstrap_sdk: add support for directly GPG signing SDK tarballs
SDK tarballs have a .DIGESTS file but it is created by catalyst instead
of the upload_image function. In order to support plain GPG signing but
not avoid re-generating .DIGESTS we need to move that code out of
upload_image to a new function. upload_files shouldn't do it itself
because it is also used for portage binary packages which shouldn't be
signed (there is no point, nothing would verify the signatures).
2015-06-28 17:02:23 -07:00
Michael Marineau
4b1a608c2e bootstrap_sdk: prune extra files from SDK tarballs
stage1/2/3 tarballs automatically prune things like /usr/portage but
stage4 does not. Add explicit rules to prune extra cruft.
2014-12-23 17:07:45 -08:00
Michael Marineau
1016bb323b bootstrap_sdk: setup /usr/lib correctly before calling set_lsb_release
os-release is now written to /usr/lib but that is likely a symlink to
/usr/lib64 so a little extra logic is required to avoid clobbering the
symlink.
2014-07-14 17:41:18 -07:00
Michael Marineau
8244c7a260 cleanup(set_lsb_release): Rework release config setup
- Remove custom COREOS_* attributes from /etc/lsb-release
- Move dev image logic to dev_image_util
  For extra fun fix detection of local host URL for devserver.
- Remove weirdly verbose "DESCRIPTION" format.
- Add COREOS_RELEASE_BOARD back to /usr/share/coreos/release
  This is mostly just so update_engine and gmerge report the correct
  board name to devserver, informative-only on prod images.
- Remove version info from /etc/gentoo-release
- Switch from 'track' to 'group' terminology.
2014-03-19 15:56:21 -07:00
Michael Marineau
75972cd991 fix(catalyst): Always use the current SDK tarball as seed.
Right now there is some funky logic to either use a previous build as a
seed or the current SDK tarball if it happens to have been downloaded.
This is a bit confusing and doesn't work reliably since it is reasonable
for there to be neither a previous build or the current SDK available if
the SDK chroot was created some time ago. Fix this by using the new SDK
library and always use the latest SDK, downloading it if needed.
2013-11-23 20:32:55 -08:00
Michael Marineau
763b27bb7f fix(common.sh): Move DIGESTS handling code to common functions.
This code would be useful to use when downloading SDK tarballs in
addition to uploading them. :)
2013-11-22 19:15:10 -08:00
Michael Marineau
6778eeda83 fix(bootstrap_sdk): Remove toolchain build step, replaced by build_toolchains 2013-11-07 13:28:13 -08:00
Michael Marineau
5adbfd8a32 fix(catalyst): Move catalyst scripts from lib to build_library.
Just seems like a better place for them.
2013-10-10 11:47:09 -07:00
Michael Marineau
29ccafbdba fix(sdk): Use coreos-devel/sdk-depends instead of hard-host-depends
coreos-devel/sdk-depends is a super-set of hard-host-depends and has a
somewhat better name.
2013-08-28 15:59:05 -07:00
Michael Marineau
9794ab32b1 feat(bootstrap_sdk): Add release data to SDK tarballs. 2013-08-05 23:18:41 -04:00
Michael Marineau
3600615dc8 fix(bootstrap_sdk): skip final release goo if stage4 wasn't built 2013-08-05 22:44:27 -04:00
Michael Marineau
f0c2cb1ccd fix(bootstrap_sdk): Fix upload path.
Previous commit added an extra /coreos directory to the path.
2013-07-18 00:44:57 -04:00
Michael Marineau
6b336e17b2 fix(bootstrap_sdk): Move gsutil code to release_util.sh
Sync up bootstrap_sdk with other tools by using the common upload
functions. As part of this refactor release_util a bit to provide a
truly generic upload function.
2013-07-17 19:25:46 -04:00
Michael Marineau
d3e741b807 fix(bootstrap_sdk): Rename catalyst_stage4.sh since it is sdk specific
About to become a lot more sdk specific too. :)
2013-07-09 15:57:21 -04:00
Michael Marineau
6c1e03c06e fix(bootstrap_sdk): Report the time it took to complete 2013-07-05 23:57:04 -04:00
Michael Marineau
e9ca88bc69 fix(bootstrap_sdk): Default to uploading official builds. 2013-07-03 12:24:09 -04:00