cloudapi: enable edge-commit on Fedora
We have to do a small hack to enable edge-commit on Fedora because its name is different. We can also change this in the image definition but I want to iterate quickly on the Fedora Integration MVP and don't want to run in any conflicts with https://github.com/osbuild/osbuild-composer/pull/2461 This commit also enables a test for Fedora IoT built through the API. While enabling the test, I also simplified our decision logic for SSH_USER and DISTRO. Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
parent
bf46113251
commit
80af9cac98
3 changed files with 28 additions and 44 deletions
|
|
@ -392,6 +392,9 @@ API:
|
||||||
- aws/rhel-8.6-nightly-x86_64
|
- aws/rhel-8.6-nightly-x86_64
|
||||||
- aws/rhel-9.0-nightly-x86_64
|
- aws/rhel-9.0-nightly-x86_64
|
||||||
INTERNAL_NETWORK: ["true"]
|
INTERNAL_NETWORK: ["true"]
|
||||||
|
- IMAGE_TYPE: ["edge-commit"]
|
||||||
|
RUNNER:
|
||||||
|
- aws/fedora-35-x86_64
|
||||||
|
|
||||||
libvirt:
|
libvirt:
|
||||||
stage: test
|
stage: test
|
||||||
|
|
|
||||||
|
|
@ -279,7 +279,7 @@ func (h *apiHandlers) PostCompose(ctx echo.Context) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return HTTPError(ErrorUnsupportedArchitecture)
|
return HTTPError(ErrorUnsupportedArchitecture)
|
||||||
}
|
}
|
||||||
imageType, err := arch.GetImageType(imageTypeFromApiImageType(ir.ImageType))
|
imageType, err := arch.GetImageType(imageTypeFromApiImageType(ir.ImageType, arch))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return HTTPError(ErrorUnsupportedImageType)
|
return HTTPError(ErrorUnsupportedImageType)
|
||||||
}
|
}
|
||||||
|
|
@ -715,7 +715,7 @@ func generateManifest(ctx context.Context, cancel context.CancelFunc, workers *w
|
||||||
jobResult.Manifest = manifest
|
jobResult.Manifest = manifest
|
||||||
}
|
}
|
||||||
|
|
||||||
func imageTypeFromApiImageType(it ImageTypes) string {
|
func imageTypeFromApiImageType(it ImageTypes, arch distro.Arch) string {
|
||||||
switch it {
|
switch it {
|
||||||
case ImageTypesAws:
|
case ImageTypesAws:
|
||||||
return "ami"
|
return "ami"
|
||||||
|
|
@ -738,6 +738,13 @@ func imageTypeFromApiImageType(it ImageTypes) string {
|
||||||
case ImageTypesImageInstaller:
|
case ImageTypesImageInstaller:
|
||||||
return "image-installer"
|
return "image-installer"
|
||||||
case ImageTypesEdgeCommit:
|
case ImageTypesEdgeCommit:
|
||||||
|
// Fedora doesn't define "rhel-edge-commit", or "edge-commit" yet.
|
||||||
|
// Assume that if the distro contains "fedora-iot-commit", it's Fedora
|
||||||
|
// and translate ImageTypesEdgeCommit to fedora-iot-commit in this case.
|
||||||
|
// This should definitely be removed in the near future.
|
||||||
|
if _, err := arch.GetImageType("fedora-iot-commit"); err == nil {
|
||||||
|
return "fedora-iot-commit"
|
||||||
|
}
|
||||||
return "rhel-edge-commit"
|
return "rhel-edge-commit"
|
||||||
case ImageTypesEdgeContainer:
|
case ImageTypesEdgeContainer:
|
||||||
return "rhel-edge-container"
|
return "rhel-edge-container"
|
||||||
|
|
|
||||||
|
|
@ -458,48 +458,22 @@ else
|
||||||
TEST_ID=$(uuidgen);
|
TEST_ID=$(uuidgen);
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$ID-$VERSION_ID" in
|
if [[ "$ID" == "fedora" ]]; then
|
||||||
"rhel-9.0")
|
# fedora uses fedora for everything
|
||||||
DISTRO="rhel-90"
|
SSH_USER="fedora"
|
||||||
if [[ "$CLOUD_PROVIDER" == "$CLOUD_PROVIDER_AWS" ]]; then
|
elif [[ "$CLOUD_PROVIDER" == "$CLOUD_PROVIDER_AWS" ]]; then
|
||||||
SSH_USER="ec2-user"
|
# RHEL and centos use ec2-user for AWS
|
||||||
else
|
SSH_USER="ec2-user"
|
||||||
SSH_USER="cloud-user"
|
else
|
||||||
fi
|
# RHEL and centos use cloud-user for other clouds
|
||||||
;;
|
SSH_USER="cloud-user"
|
||||||
"rhel-8.6")
|
fi
|
||||||
DISTRO="rhel-86"
|
|
||||||
if [[ "$CLOUD_PROVIDER" == "$CLOUD_PROVIDER_AWS" ]]; then
|
# This removes dot from VERSION_ID.
|
||||||
SSH_USER="ec2-user"
|
# ID == rhel && VERSION_ID == 8.6 => DISTRO == rhel-86
|
||||||
else
|
# ID == centos && VERSION_ID == 8 => DISTRO == centos-8
|
||||||
SSH_USER="cloud-user"
|
# ID == fedora && VERSION_ID == 35 => DISTRO == fedora-35
|
||||||
fi
|
DISTRO="$ID-${VERSION_ID//./}"
|
||||||
;;
|
|
||||||
"rhel-8.5")
|
|
||||||
DISTRO="rhel-85"
|
|
||||||
if [[ "$CLOUD_PROVIDER" == "$CLOUD_PROVIDER_AWS" ]]; then
|
|
||||||
SSH_USER="ec2-user"
|
|
||||||
else
|
|
||||||
SSH_USER="cloud-user"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"centos-8")
|
|
||||||
DISTRO="centos-8"
|
|
||||||
if [[ "$CLOUD_PROVIDER" == "$CLOUD_PROVIDER_AWS" ]]; then
|
|
||||||
SSH_USER="ec2-user"
|
|
||||||
else
|
|
||||||
SSH_USER="cloud-user"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"centos-9")
|
|
||||||
DISTRO="centos-9"
|
|
||||||
if [[ "$CLOUD_PROVIDER" == "$CLOUD_PROVIDER_AWS" ]]; then
|
|
||||||
SSH_USER="ec2-user"
|
|
||||||
else
|
|
||||||
SSH_USER="cloud-user"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Only RHEL need subscription block.
|
# Only RHEL need subscription block.
|
||||||
if [[ "$ID" == "rhel" ]]; then
|
if [[ "$ID" == "rhel" ]]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue