distro/{rhel86,rhel90}: specify a remote for deployments

When deploying an ostree commit, specify a remote, currently hard-
coded to `rhel-edge`, so that updates work automatically, if they
are served from the same location as the initial commit is pulled
from.

NB: now that the remote is specified in the raw image, remove the
corresponding bits form the tests.

Signed-off-by: Antonio Murdaca <runcom@linux.com>
This commit is contained in:
Christian Kellner 2021-08-28 15:58:39 +02:00 committed by Achilleas Koutsou
parent 4b84a3c70f
commit b18b4e80a0
4 changed files with 36 additions and 12 deletions

View file

@ -790,10 +790,11 @@ func ostreeDeployPipeline(
p.Name = "image-tree"
p.Build = "name:build"
osname := "redhat"
remote := "rhel-edge"
p.AddStage(osbuild.OSTreeInitFsStage())
p.AddStage(osbuild.NewOSTreePullStage(
&osbuild.OSTreePullStageOptions{Repo: repoPath},
&osbuild.OSTreePullStageOptions{Repo: repoPath, Remote: remote},
ostreePullStageInputs("org.osbuild.source", options.OSTree.Parent, options.OSTree.Ref),
))
p.AddStage(osbuild.NewOSTreeOsInitStage(
@ -807,6 +808,7 @@ func ostreeDeployPipeline(
&osbuild.OSTreeDeployStageOptions{
OsName: osname,
Ref: options.OSTree.Ref,
Remote: remote,
Mounts: []string{"/boot", "/boot/efi"},
Rootfs: osbuild.Rootfs{
Label: "root",
@ -817,6 +819,21 @@ func ostreeDeployPipeline(
},
},
))
if options.OSTree.URL != "" {
p.AddStage(osbuild.NewOSTreeRemotesStage(
&osbuild.OSTreeRemotesStageOptions{
Repo: "/ostree/repo",
Remotes: []osbuild.OSTreeRemote{
{
Name: remote,
URL: options.OSTree.URL,
},
},
},
))
}
p.AddStage(osbuild.NewOSTreeFillvarStage(
&osbuild.OSTreeFillvarStageOptions{
Deployment: osbuild.OSTreeDeployment{

View file

@ -786,10 +786,11 @@ func ostreeDeployPipeline(
p.Name = "image-tree"
p.Build = "name:build"
osname := "redhat"
remote := "rhel-edge"
p.AddStage(osbuild.OSTreeInitFsStage())
p.AddStage(osbuild.NewOSTreePullStage(
&osbuild.OSTreePullStageOptions{Repo: repoPath},
&osbuild.OSTreePullStageOptions{Repo: repoPath, Remote: remote},
ostreePullStageInputs("org.osbuild.source", options.OSTree.Parent, options.OSTree.Ref),
))
p.AddStage(osbuild.NewOSTreeOsInitStage(
@ -803,6 +804,7 @@ func ostreeDeployPipeline(
&osbuild.OSTreeDeployStageOptions{
OsName: osname,
Ref: options.OSTree.Ref,
Remote: remote,
Mounts: []string{"/boot", "/boot/efi"},
Rootfs: osbuild.Rootfs{
Label: "root",
@ -813,6 +815,21 @@ func ostreeDeployPipeline(
},
},
))
if options.OSTree.URL != "" {
p.AddStage(osbuild.NewOSTreeRemotesStage(
&osbuild.OSTreeRemotesStageOptions{
Repo: "/ostree/repo",
Remotes: []osbuild.OSTreeRemote{
{
Name: remote,
URL: options.OSTree.URL,
},
},
},
))
}
p.AddStage(osbuild.NewOSTreeFillvarStage(
&osbuild.OSTreeFillvarStageOptions{
Deployment: osbuild.OSTreeDeployment{

View file

@ -604,11 +604,6 @@ until [ "$(sudo podman inspect -f '{{.State.Running}}' rhel-edge)" == "true" ];
sleep 1;
done;
# Workaround to https://github.com/osbuild/osbuild-composer/issues/1693
greenprint "🗳 Add external prod edge repo"
sudo ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" admin@${UEFI_GUEST_ADDRESS} "echo ${EDGE_USER_PASSWORD} |sudo -S ostree remote add --no-gpg-verify --no-sign-verify rhel-edge ${PROD_REPO_URL}"
sudo ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" admin@${UEFI_GUEST_ADDRESS} "echo ${EDGE_USER_PASSWORD} |sudo -S ostree admin switch rhel-edge:${OSTREE_REF}"
# Pull upgrade to prod mirror
greenprint "⛓ Pull upgrade to prod mirror"
sudo ostree --repo="$PROD_REPO" pull --mirror edge-stage "$OSTREE_REF"

View file

@ -662,11 +662,6 @@ until [ "$(sudo podman inspect -f '{{.State.Running}}' rhel-edge)" == "true" ];
sleep 1;
done;
# Workaround to https://github.com/osbuild/osbuild-composer/issues/1693
greenprint "🗳 Add external prod edge repo"
sudo ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" admin@${UEFI_GUEST_ADDRESS} "echo ${EDGE_USER_PASSWORD} |sudo -S ostree remote add --no-gpg-verify --no-sign-verify rhel-edge ${PROD_REPO_URL}"
sudo ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" admin@${UEFI_GUEST_ADDRESS} "echo ${EDGE_USER_PASSWORD} |sudo -S ostree admin switch rhel-edge:${OSTREE_REF}"
# Pull upgrade to prod mirror
greenprint "⛓ Pull upgrade to prod mirror"
sudo ostree --repo="$PROD_REPO" pull --mirror edge-stage "$OSTREE_REF"