Commit Graph

159 Commits

Author SHA1 Message Date
Jan Stodola
fa1aeec58e Fix keeping files on Amazon s3
(cherry picked from commit b57de93468)
(cherry picked from commit ae5475c178)
2019-05-06 12:07:54 -07:00
Jan Stodola
0314b6125f Allow to keep objects in AWS
Instances, Volumes, Snapshots, AMIs and s3 objects with the "keep_me" tag will
not be deleted automatically even if they are older then the specified time limit.

(cherry picked from commit db7b1e4fcd)
(cherry picked from commit 0029f23b0e)
2019-05-06 12:07:54 -07:00
David Shea
9a4a45f05a Add a compose type for alibaba.
This compose type creates a partitioned disk as a qcow2 file, but with
only one partition instead of using a separate /boot.

(cherry picked from commit 44e14176bb)
(cherry picked from commit 0f59e576d8)
2019-05-06 12:07:29 -07:00
David Shea
0220077242 Add a new compose type for Hyper-V
This is based on the VHD compose type, with the following differences:

  * Use the vhdx format instead of vhd
  * No WALinuxAgent
  * Install hyperv-daemons

The hyperv-daemons are activated through udev rules, so there is no need
to add them to the services line.

(cherry picked from commit 434fe58c28)
(cherry picked from commit 367c2583e4)
2019-05-06 12:07:29 -07:00
David Shea
c1628bd171 Add a compose check for google cloud images.
(cherry picked from commit c6fcf9d1eb)
(cherry picked from commit f35425795e)
2019-05-06 12:07:29 -07:00
David Shea
69caef3c2d Add a compose type for Google Compute Engine
(cherry picked from commit bd804c271b)
(cherry picked from commit 846d839980)
2019-05-06 12:07:29 -07:00
David Shea
b52877b63c Support compressing single files.
Modify imgutils.compress to allow the "rootdir" argument to be either a
directory or a single file to add to an archive.

(cherry picked from commit c585b91422)
(cherry picked from commit 5308e7bfec)
2019-05-06 12:07:29 -07:00
David Shea
c74e50d99d Add an option to align the image size to a multiplier.
If provided, round the disk image size up to a multiple of the value.
This allows for image formats with specific size-alignment requirements
(e.g., disk size must be in GiB).

(cherry picked from commit 8ef4f431d8)
(cherry picked from commit b2a33d5654)
2019-05-06 12:07:29 -07:00
Brian C. Lane
4fa08eb8e1 Add more tests for gitrpm.py
Make sure that dotfiles are installed when not directly under /
Make sure / is not packaged in the rpm (it will cause a conflict with
the filesystem package).
Make sure that using destination="/" works

(cherry picked from commit 6fd06c6931)
(cherry picked from commit d5d60ebe6d)
2019-05-06 12:07:06 -07:00
Brian C. Lane
7a86aa1d17 pylorax.ltmpl: Add a test for missing quotes
It should raise an error if a quote is missing in the template.

(cherry picked from commit df3aeee802)
(cherry picked from commit 1d4f47e26f)
2019-05-06 12:07:06 -07:00
Jiri Kortus
4c313acc64 Add checks for disabled root account
The root account checks are applied to generated and deployed images
to make sure that root account is locked, except for live ISO.

(cherry picked from commit 655e7e40c0)
(cherry picked from commit 7c093ecbb4)
2019-05-06 12:07:06 -07:00
Chris Roberts
3339048a66 Update datastore for VMware testing
(cherry picked from commit 32d5ff8615)
(cherry picked from commit 7bf3371e33)
2019-05-06 12:07:06 -07:00
Brian C. Lane
c5108bce9f Add tests using repos.git in blueprints
- Check final-kickstart.ks for the rpm source
- Check final-kickstart.ks for the rpm package name and version
- Make sure depsolve works
- Make sure errors from a bad repo are returned correctly
- Make sure errors from a bad reference are returned correctly

This moves _wait_for_status into a helper function so it can be shared
between the test classes.

(cherry picked from commit 8c2184d59e)
(cherry picked from commit 78f79a94ec)
2019-05-06 12:06:06 -07:00
Brian C. Lane
5042867d19 Move git repo creation into tests/lib.py
This way it can be shared with test_server.py

(cherry picked from commit 02f757d231)
(cherry picked from commit 136f9d877a)
2019-05-06 12:06:06 -07:00
Brian C. Lane
b25995d9d4 rpmgit: catch potential errors while running git
Log them and report them as RuntimeError. Also add a couple tests for
them.

(cherry picked from commit 61efa91a03)
(cherry picked from commit 087b0fe8c6)
2019-05-06 12:06:06 -07:00
Brian C. Lane
7a6ebb0ad3 tests: Add test for Recipe.freeze() function
The freeze function was not being tested. Add a test for it using the
repos.git test recipe.

(cherry picked from commit c26477a63c)
(cherry picked from commit bdf5572bc6)
2019-05-06 12:05:42 -07:00
Brian C. Lane
8696f197d4 Add repos.git support to lorax-composer builds
This hooks up creation of the rpm to the build, adds it to the
kickstart, and passes the url to Anaconda. The dnf repo with the rpms is
created under the results directory so it will be included when
downloading the build's results.

(cherry picked from commit cd8c884adb)
(cherry picked from commit 2e596010d3)
2019-05-06 12:05:34 -07:00
Brian C. Lane
0169422746 Add pylorax.api.gitrpm module and tests
This handles creating the rpm from the dictionary describing the
repository and rpm. Also adds tests for archive and rpm creation.

(cherry picked from commit f6f2308765)
(cherry picked from commit efc77c1d71)
2019-05-06 12:05:34 -07:00
Brian C. Lane
21b03c2108 Add support for [[repos.git]] section to blueprints
This adds support, documentation, and testing for a [[repos.git]]
blueprint section that can be used to install files from a git
repository. It will create an rpm that will be added to the build,
and included in the metadata that can be downloaded. This allows you to
accurately keep track of the source of configuration files and extra
metadata that is added to the build.

The source repo and reference will be listed in the rpm's summary making
it easy to discover on the installed system.

(cherry picked from commit d7b96c8f0f)
(cherry picked from commit 047f174dcf)
2019-05-06 12:05:34 -07:00
Alexander Todorov
530279c44a Allow overriding $CLI outside test scripts
this will allow you to test against installed RPM like so:

    # export CLI="/usr/bin/composer-cli"
    # make test_images

If you already have lorax-composer running then you can directly
execute test scripts:

    # ./tests/cli/test_build_and_deploy_aws.sh

(cherry picked from commit 85dfbd7911)
(cherry picked from commit 1053c7477e)
2019-05-06 12:00:22 -07:00
Alexander Todorov
d0ac25d022 New test: Build live-iso and boot with KVM
explicitly enables sshd for live-iso during testing

(cherry picked from commit eef11ef405)
(cherry picked from commit 60daacfc38)
2019-05-06 12:00:22 -07:00
Brian C. Lane
2dd3dd54c5 lorax-composer: Return UnknownBlueprint errors when using deleted blueprints
Reading a blueprint wasn't checking to see if it had been deleted so it
was returning the most recent commit before it had been deleted. This
allowed things like starting a compose with a blueprint that technically
doesn't exist.

One exception to this is the /changes/ route, it must be available so
that you can use the commit hash to undo a delete.

This also adds tests for the various operations.

Resolves: rhbz#1682113
(cherry picked from commit d32f477e0b)
(cherry picked from commit 82aa9cdbc6)
2019-05-06 12:00:22 -07:00
Brian C. Lane
d0458750df lorax-composer: Delete workspace copy when deleting blueprint
Also extends the blueprint delete test to also check the workspace.

(cherry picked from commit 26bd2c1378)
(cherry picked from commit 5c0f127b3c)
2019-05-06 12:00:22 -07:00
Alexander Todorov
21975b44da New test: Build qcow2 compose and test it with QEMU-KVM
(cherry picked from commit b936dfb198)
(cherry picked from commit 3f000b1fe3)
2019-05-06 12:00:22 -07:00
Brian C. Lane
35faa61f7e lorax-composer: pass customization.kernel append to extra_boot_args
This allows iso builds to include the extra kernel boot parameters by
passing them to the arch-specific live/*tmpl template.

Also adds tests to make sure it is written to config.toml in the build
metadata.

(cherry picked from commit 5dea308080)
(cherry picked from commit 2861bdb95e)
2019-05-06 11:56:17 -07:00
Brian C. Lane
afa68df873 lorax-composer: Add the ability to append to the kernel command-line
Sometimes it is necessary to modify the kernel command-line of the
image, this adds support for a [customizations.kernel] section to the
blueprint:

[customizations.kernel]
append = "nosmt=force"

This will be appended to the kickstart's bootloader --append argument.

Includes tests for modifying the bootloader line, the kickstart
template, and examining the final-kickstart.ks created for a compose.

(cherry picked from commit 59464286f9)
(cherry picked from commit c5f4dfe113)
2019-05-06 11:54:56 -07:00
Brian C. Lane
850c35a613 Fix pylint problems with vmware_list_vms.py
(cherry picked from commit fc9ccb51ee)
2019-05-06 11:45:32 -07:00
Brian C. Lane
1fd73cde52 Move the package requirements for live-iso setup out of the template
In order to support iso creation on multiple arches with the templates
we need to be able to select different packages based on arch.
lorax-composer uses the arch-specific Lorax templates in order to
generate the output iso so this patch:

1. Creates a new template and type to parse it, live-install.tmpl
   which contains only installpkg commands and #if clauses for arch
2. Removes bootloader related packages from the live-iso.ks
3. Remove dracut-config-rescue exclusion because it can cause problems
   with some blueprints.
4. Switch logo requirement to system-logos which is satisfied by
   generic-logos or fedora-logos. This prevents conflicts when a blueprint
   installs fedora-release-workstation.

So in the future, if x86.tmpl, etc. need a new package to support
creating the iso it should be added to the correct section in
./share/live/live-install.tmpl

(cherry picked from commit 3b8de2a233)
2019-05-06 11:45:32 -07:00
Brian C. Lane
19375b9d4e livemedia-creator: Add support for reqpart kickstart command
reqpart can be used to make kickstarts more platform agnostic, creating
needed partitions without lmc having to keep track of the arch-specific
needs. eg. ppc64 needs prepboot and /boot

This increases the size of the disk based on whether reqpart or
reqpart --add-boot is in the kickstart.

Note that this is only valid for partitioned disk output types, not
for filesystem images or live iso output.

(cherry picked from commit b47554d716)
2019-05-06 11:45:32 -07:00
Jan Stodola
f02eab78a3 Add script for removing old artifacts from VMware
(cherry picked from commit ce110afd22)
2019-05-06 11:45:32 -07:00
Brian C. Lane
3d2c085cf0 Clarify the ks repo only error message
This also moves the run_creator kickstart checks into check_kickstart
so that tests may be added.

This will close #164

(cherry picked from commit 3676cb65bb)
2019-05-06 11:45:09 -07:00
Brian C. Lane
30098a52e3 tests: Fix makeFakeRPM calls
(cherry picked from commit 28bd68793b)
2019-05-03 17:05:57 -07:00
Alexander Todorov
ce361d6f48 New test: Verify tar images with Docker and systemd-nspawn
- on some arches (also Fedora x86_64) systemd-nspawn may not be
  available
- delete composes from other tests in rlPhaseStartCleanup because
  we're seeing the tar compose kind of hanging in Jenkins and that
  test script is executed last so the slave may be running out of
  disk space. Be a good citizen and clean up after the previous
  tests.

(cherry picked from commit ea78cce882)
2019-05-03 17:03:40 -07:00
Alexander Todorov
b7b8731c03 Update OpenStack flavor and network settings in tests
b/c we've migrated to Upshift we must use different instance type,
specify the desired network to connect to and update how we get
the ip address of the launched VM.

(cherry picked from commit c95d7084a6)
2019-05-03 17:03:40 -07:00
Alexander Todorov
ea63fbcc5b Keep OpenStack VMs with Tag keep_me
so we can have some systems for debugging

(cherry picked from commit 5dc895fbee)
2019-05-03 17:01:30 -07:00
Jiri Kortus
f7e71768fa Make sure compose build tests run with SELinux in enforcing mode
(cherry picked from commit 57be7313c4)
2019-05-03 17:01:30 -07:00
Jan Stodola
45710e435a Add script for removing old artifacts from Azure
(cherry picked from commit f26fcba902)
2019-05-03 17:01:30 -07:00
Jan Stodola
c6bff67549 Use existing storage account
To avoid creating a new storage account for every new VM.

(cherry picked from commit 8a8802aab7)
2019-05-03 17:01:30 -07:00
Jan Stodola
0d38224f12 Record date/time of VM creation
(cherry picked from commit e918ff807c)
2019-05-03 17:01:30 -07:00
Jan Stodola
43a79746fc Export OS_PROJECT_NAME variable in openstack scripts
The OS_PROJECT_NAME (or OS_TENANT_NAME) environment variable needs to be defined.
Use the OS_PROJECT_NAME, since it is recommended in the documentation instead of
the older OS_TENANT_NAME.

(cherry picked from commit cc6fdb2fac)
2019-05-03 16:57:37 -07:00
Jan Stodola
12cd27375a Expand parameters as separate words
(cherry picked from commit 961ea18145)
2019-05-03 16:57:37 -07:00
Jan Stodola
34c24117fe Add script for removing old artifacts from OpenStack
(cherry picked from commit 6680e2ffec)
2019-05-03 16:57:37 -07:00
Jan Stodola
8885d7eaca Add script for removing old artifacts from AWS
(cherry picked from commit 677c858f60)
2019-05-03 16:57:37 -07:00
Alexander Todorov
a038f7d904 tests: use the first IP address if more than 1 retruned from OpenStack
(cherry picked from commit 883a959442)
2019-05-03 16:52:44 -07:00
Alexander Todorov
963c7d8f89 tests: remove a debugging command
(cherry picked from commit 6563a33f63)
2019-05-03 16:52:44 -07:00
Alexander Todorov
4f3b81e4e7 Teach OpenStack test to distinguish between RHEL and Fedora
(cherry picked from commit 642b909d24)
2019-05-03 16:50:33 -07:00
Alexander Todorov
7b306e2e84 Use full path for Azure playbook as well
(cherry picked from commit 543a4d88d9)
2019-05-03 16:47:52 -07:00
Alexander Todorov
9584cbd96f Use a temporary dir for ssh keys during testing
resolves path problems with sudo, we already have the same change
in the AWS test script.

(cherry picked from commit 16260c1569)
2019-05-03 16:47:46 -07:00
Alexander Todorov
c4f3ceb0ec Update V_DATASTORE b/c defaults appear to have been changed
(cherry picked from commit 59050df710)
2019-05-03 16:47:38 -07:00
Alexander Todorov
41aa84ba04 Clone pyvmomi samples in the correct directory
(cherry picked from commit e0c8cdc5a8)
2019-05-03 16:47:10 -07:00