Skip to content

Commit

Permalink
Drop CentOS 7 boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
archanaserver committed Sep 4, 2024
1 parent d8db449 commit a36d9ba
Show file tree
Hide file tree
Showing 21 changed files with 181 additions and 206 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ boxes:
exclude:
- "katello" # exclude any box containing "katello"
- "ubuntu1804-foreman-2\\.0" # exclude only the box "ubuntu1804-foreman-2.0". Notice the escaped '.' character to match the specific character instead of any single character
- "^centos7-fips" # exclude any box that starts with "centos7-fips"
- "^centos9-stream" # exclude any box that starts with "centos9-stream"
- "foreman-1\\.(?:[2][0-3])" # exclude any foreman-1.20 to foreman-1.23 version box
```

Expand Down
20 changes: 10 additions & 10 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,11 @@ importing/exporting data via [CSV](https://github.com/Katello/hammer-cli-csv).
The CLI can be configured to work with any version of Foreman. To facilitate
development in Hammer or any of its plugins, a lightweight vagrant box is
provided in the `boxes.yaml.example` file. To use this functionality, copy the
centos7-hammer-devel configuration from the example file into your `boxes.yaml`
almalinux8-hammer-devel configuration from the example file into your `boxes.yaml`
file, changing options as necessary. Then run the following:

```sh
vagrant up centos7-hammer-devel
vagrant up almalinux8-hammer-devel
```

In the vagrant box, find the Hammer repositories at `/home/vagrant/` and the
Expand All @@ -261,7 +261,7 @@ changing the hostnames as needed

```yaml
capsule-dev:
box: centos7
box: centos9-stream
ansible:
playbook: 'playbooks/foreman_proxy_content_dev.yml'
group: 'foreman-proxy-content'
Expand All @@ -283,7 +283,7 @@ capsule-dev:

```yaml
capsule-dev:
box: centos7
box: centos9-stream
ansible:
playbook: 'playbooks/foreman_proxy_content_dev.yml'
group: 'foreman-proxy-content'
Expand All @@ -299,7 +299,7 @@ The following example shows some of the extra values that can be set to control

```yaml
katello-client:
box: centos7
box: centos9-stream
ansible:
playbook: 'playbooks/katello_client.yml'
group: 'client'
Expand All @@ -320,19 +320,19 @@ To use this box, copy the configuration from `boxes.yaml.example` to
`boxes.yaml`, changing options as necessary, then run the following:

```sh
vagrant up centos7-dynflow-devel
vagrant up almalinux8-dynflow-devel
```

In the vagrant box, the dynflow repository is cloned to `/home/vagrant/dynflow`.

## Smoker

The testing tool [smoker](https://github.com/theforeman/smoker) can be set up with the `centos7-foreman-smoker` box and tests can be run against a separate Foreman/Katello instance.
The testing tool [smoker](https://github.com/theforeman/smoker) can be set up with the `almalinux8-foreman-smoker` box and tests can be run against a separate Foreman/Katello instance.

To use:
1. Ensure that you have a running instance of Foreman/Katello.
2. Follow the example box definition in `vagrant/boxes.d/99-local.yaml.example` for `centos7-foreman-smoker` and update the `smoker_base_url` variable. With `pytest_run_tests` set to false, smoker tests will not be run by the playbook, but the box will be set up with pytest and the smoker repository will be cloned to the `vagrant` user's home directory.
3. Run `vagrant up centos7-foreman-smoker`. A debug message will print showing the command to run smoker tests and the alias that has been set up. The alias is defined in `~/.bash_profile` on the box itself.
2. Follow the example box definition in `vagrant/boxes.d/99-local.yaml.example` for `almalinux8-foreman-smoker` and update the `smoker_base_url` variable. With `pytest_run_tests` set to false, smoker tests will not be run by the playbook, but the box will be set up with pytest and the smoker repository will be cloned to the `vagrant` user's home directory.
3. Run `vagrant up almalinux8-foreman-smoker`. A debug message will print showing the command to run smoker tests and the alias that has been set up. The alias is defined in `~/.bash_profile` on the box itself.
4. You can then ssh into the smoker box. Ensure the hostname of the Foreman/Katello instance can be reached by the smoker box.
5. From the smoker box, run tests as the vagrant user using the alias or running pytest commands manually. To change the testing options, please see [the smoker documentation](https://github.com/theforeman/smoker) and modify the alias or manually run pytest commands as necessary.

Expand Down Expand Up @@ -381,7 +381,7 @@ If you choose longer name you're on your own, contributions with fixes welcome!
# boxes.d/99-local.yaml
foreman-ad:
box: centos7
box: centos9-stream
memory: 4096
domain: 'example.com' # must be the AD domain
ansible:
Expand Down
6 changes: 3 additions & 3 deletions docs/library.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ Deploy a file with the base set of boxes the plugin requires:
vim base_boxes.yaml

```yaml
centos7:
box_name: 'centos/7'
image_name: !ruby/regexp '/CentOS 7.*PV/'
centos9:
box_name: 'centos/9'
image_name: !ruby/regexp '/CentOS 9.*PV/'
pty: true
```
Expand Down
2 changes: 1 addition & 1 deletion docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module APlugin

DB = 'db'
WEB = 'web'
PARENT_NAME = 'centos7-katello-devel'
PARENT_NAME = 'centos9-katello-devel'
PROJECT_PATH = "#{Forklift::ROOT}/../a_repo"

Forklift.define_vm config, Forklift.new_box(PARENT_NAME, DB) do |machine|
Expand Down
16 changes: 8 additions & 8 deletions docs/production.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ vagrant status
This will show a list of boxes by type and OS. For example, at the time of this documentation both Foreman 1.12 and Katello 3.1 had been released. Thus, when doing a status I see, for example:

```
centos7-foreman-nightly not created (libvirt)
centos7-katello-nightly not created (libvirt)
centos7-foreman-proxy-nightly not created (libvirt)
centos7-foreman-1.16 not created (libvirt)
centos7-katello-3.4 not created (libvirt)
centos9-stream-foreman-nightly not created (libvirt)
centos9-stream-katello-nightly not created (libvirt)
centos9-stream-foreman-proxy-nightly not created (libvirt)
centos9-stream-foreman-3.11 not created (libvirt)
centos9-stream-katello-4.13 not created (libvirt)
```

This indicates that both Foreman and Katello nightly (our unstable releases) are available as well as production installations on Centos 7 boxes of Foreman, Katello and a Foreman Proxy. To fire up a Katello 3.4:
This indicates that both Foreman and Katello nightly (our unstable releases) are available as well as production installations on Centos 9 boxes of Foreman, Katello and a Foreman Proxy. To fire up a Katello 4.13:

Start the installation for CentOS 7:
Start the installation for CentOS 9:

vagrant up centos7-katello-3.4
vagrant up centos9-stream-katello-4.13

This will create a libvirt based virtual machine running the Katello server on CentOS.

Expand Down
14 changes: 7 additions & 7 deletions docs/provision.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ reboot:

2. Build a box

- Option 1: Use the `centos7-provision-nightly` box.
- Option 1: Use the `centos9-provision-nightly` box.

- Option 2: Use an existing katello box (e.g. centos7-katello-p4-nightly) and run the provisioning playbook (it takes a while, as it syncs (on-demand) centos7, puppet 4). ***Note*: If you are using puppet 4, you need to increase the ram on the box, to something like 8096 otherwise candlepin crashes with OOM.**
`ansible-playbook -l centos7-katello-p4-nightly playbooks/katello_provisioning.yml`
- Option 2: Use an existing katello box (e.g. centos9-katello-p7-nightly) and run the provisioning playbook (it takes a while, as it syncs (on-demand) centos9, puppet 7). ***Note*: If you are using puppet 7, you need to increase the ram on the box, to something like 8096 otherwise candlepin crashes with OOM.**
`ansible-playbook -l centos9-katello-p7-nightly playbooks/katello_provisioning.yml`

4. Login and create a compute profile, because this isn't possible with hammer or the API.

- Click Infrastructure / Compute Resources
- Click "libvirt"
- Click Compute profiles
- Click 2-Medium
- increse ram to 1024MB (required for centos 7)
- increse ram to 2048MB (required for centos 9)
- change network type to NAT, network name = provision
- Click Submit

Expand All @@ -37,9 +37,9 @@ reboot:

6. Configure / Host groups

- Edit Forklift CentOS 7
- Edit Forklift CentOS 9
- Set Compute profile to be "2-Medium"
- Assign the `CentOS 7` activation key to the host group
- Assign the `CentOS 9` activation key to the host group

7. You're good to go! Let's provision a box!

Expand All @@ -50,4 +50,4 @@ reboot:

DONE! Click submit :tada:

7. If you want to view the console while it boots, make sure to trust the CA certificate in your browser, it's hosted at https://centos7-katello-nightly.example.com/pub/katello-server-ca.crt, and you'll need to make sure you're accessing the katello via it's proper hostname (add an entry to /etc/hosts)
7. If you want to view the console while it boots, make sure to trust the CA certificate in your browser, it's hosted at https://centos9-katello-nightly.example.com/pub/katello-server-ca.crt, and you'll need to make sure you're accessing the katello via it's proper hostname (add an entry to /etc/hosts)
20 changes: 10 additions & 10 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ Included with forklift is a small live test suite. The current tests are:

```
cp boxes.yaml.example boxes.yaml
vagrant up centos7-katello-bats-ci
vagrant up almalinux8-katello-bats-ci
```

If you are making changes to bats tests and want to test your updates, edit `centos7-katello-bats-ci` to include:
If you are making changes to bats tests and want to test your updates, edit `almalinux8-katello-bats-ci` to include:

```yaml
ansible:
Expand All @@ -41,7 +41,7 @@ ansible:
bats_update_forklift: "no"
```
Or if you want to run bats from a different repository or branch, edit `centos7-katello-bats-ci` to include:
Or if you want to run bats from a different repository or branch, edit `almalinux8-katello-bats-ci` to include:

```yaml
ansible:
Expand Down Expand Up @@ -79,18 +79,18 @@ When you are finished with the test, you can tear down the associated infrastruc
### Existing Pipelines

* `install_pipeline` - Installs a Server and a Proxy VMs and runs the `foreman_testing` role to verify the setup.
Expects the `pipeline_os` variable to be set to a known OS (currently: centos7, debian10)
Expects the `pipeline_os` variable to be set to a known OS (currently: centos9-stream, debian10)
Expects the `pipeline_type` variable to be set to a known type (currently: foreman, katello, luna)
Expects the `pipeline_version` variable to be set to a known version (currently: 3.8, 3.9, 3.10, 3.11, nightly)
* `upgrade_pipeline` - Installs a VM, upgrades it twice and runs the `foreman_testing` role to verify the final upgrade.
Expects the `pipeline_os` variable to be set to a known OS (currently: centos7, debian10)
Expects the `pipeline_os` variable to be set to a known OS (currently: centos9-stream, debian10)
Expects the `pipeline_type` variable to be set to a known type (currently: foreman, katello, luna)
Expects the `pipeline_version` variable to be set to a known version (currently: 3.8, 3.9, 3.10, 3.11, nightly).

#### Examples

ansible-playbook pipelines/install_pipeline.yml -e forklift_state=up -e pipeline_os=debian10 -e pipeline_type=foreman -e pipeline_version=nightly
ansible-playbook pipelines/upgrade_pipeline.yml -e forklift_state=up -e pipeline_os=centos7 -e pipeline_type=katello -e pipeline_version=3.10
ansible-playbook pipelines/upgrade_pipeline.yml -e forklift_state=up -e pipeline_os=centos9-stream -e pipeline_type=katello -e pipeline_version=3.10

### Creating Pipelines

Expand All @@ -102,11 +102,11 @@ For Katello 3.11, you'd be adding the following two files:
```yaml
forklift_name: pipeline-katello-3.11
forklift_boxes:
pipeline-katello-3.11-centos7:
box: centos7
pipeline-katello-3.11-centos9:
box: centos9-stream
memory: 8192
pipeline-proxy-3.11-centos7:
box: centos7
pipeline-proxy-3.11-centos9:
box: centos9-stream
memory: 3072
katello_repositories_version: '3.11'
foreman_repositories_version: '1.21'
Expand Down
47 changes: 23 additions & 24 deletions packer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,72 +4,71 @@ This directory contains [packer](https://www.packer.io/) templates to create ima

You can install packer using [the steps in their documentation](http://packer.io/intro/getting-started/install.html). For Fedora and Red Hat flavor distributions, be aware there can be another executable installed named `packer`, so you will have to install the `packer` executable under another name or call it with an absolute path. See [their documentation for more info](http://packer.io/intro/getting-started/install.html#troubleshooting)

*Be aware* that enabling the hashicorp repo will make an updated vagrant rpm available. If you are using the Fedora-supplied vagrant, disable this repository immediately after installing packer.
*Be aware* that enabling the hashicorp repo will make an updated vagrant rpm available. If you are using the Fedora-supplied vagrant, disable this repository immediately after installing packer.

### Local usage

From this directory, use `packer build` followed by the json packer template to create an image

For example: `packer build centos7-katello-devel-stable.json`
For example: `packer build almalinux8-katello-devel-stable.json`

You can create a box image using the above command and then add that box to vagrant:

```
vagrant box add --name centos7-katello-devel-stable centos7-katello-devel-stable.box
vagrant box add --name almalinux8-katello-devel-stable almalinux8-katello-devel-stable.box
```

Then you can use it in a box definition. For the box built with `centos7-katello-devel-stable.json`, you will need to use the stable hostname.
Then you can use it in a box definition. For the box built with `almalinux8-katello-devel-stable.json`, you will need to use the stable hostname.

```
centos7-katello-devel-stable:
box_name: centos7-katello-devel-stable
hostname: centos7-katello-devel-stable.example.com
almalinux8-katello-devel-stable:
box_name: almalinux8-katello-devel-stable
hostname: almalinux8-katello-devel-stable.example.com
```

You can then `vagrant up centos7-katello-devel-stable`

You can then `vagrant up almalinux8-katello-devel-stable`

If you want to completely remove the box, be sure to remove from both vagrant and virsh. This can be helpful if you have built a new packer box image and want to use it.

```
vagrant box remove centos7-katello-devel-stable
sudo virsh vol-delete --pool default centos7-katello-devel-stable_vagrant_box_image_0.img
vagrant box remove almalinux8-katello-devel-stable
sudo virsh vol-delete --pool default almalinux8-katello-devel-stable_vagrant_box_image_0.img
```

## Creating version specific Katello devel boxes

Versioned Katello devel boxes allow easier patch development on old versions of Katello. This could be used for creating a fix or updating a vcr cassette for an older release.
Versioned Katello devel boxes allow easier patch development on old versions of Katello. This could be used for creating a fix or updating a vcr cassette for an older release.

To create a version specific dev box, follow the directions above to install packer, then:

```
cd ./forklift/packer
```

and run this comand (replacing 3.18 with the correct version):
and run this comand (replacing 4.13 with the correct version):

```
./scripts/build_stable_dev_box.rb 3.18
./scripts/build_stable_dev_box.rb 4.13
```

To test the newly created box:
1. add the printed box definition to vagrant/boxes.d/99-local.yaml
2. run printed 'vagrant box add' command
3. vagrant up centos7-katello-3.18-stable
3. vagrant up centos9-stream-katello-4.13-stable
4. Verify that 'rpm -q katello-repos' is correct and the foreman and katello git repos are on the correct branches

## Uploading a versioned box to Vagrant Cloud

The version of Vagrant shipped with Fedora does not support Vagrant Cloud uploads (due to a library licensing issue):

1. Deploy a Centos 7 VM (vagrant up centos7)
1. Deploy a Centos 9 VM (vagrant up centos9-stream)
2. Install latest vagrant from: https://www.vagrantup.com/docs/installation
3. scp the .box file over to the centos 7 vm
4. Run 'vagrant login' and login with your credentials
3. scp the .box file over to the centos 9 vm
4. Run 'vagrant login' and login with your credentials
5. Ensure you are an owner of the katello organization in vagrant cloud
6. Use the command from the build_stable_dev_box.rb output to publish the box, it will look like:
```
vagrant cloud publish -d "katello-devel 3.18" -s "katello-devel 3.18" katello/katello-devel 3.18.0 libvirt centos7-katello-3.18-stable.box
vagrant cloud publish -d "katello-devel 4.13" -s "katello-devel 4.13" katello/katello-devel 4.13.0 libvirt centos9-stream-katello-4.13-stable.box
```

NOTE: YOU WILL GET AN ERROR, BUT THE UPLOAD WILL ACTUALLY WORK. This only happens during large box uploads to vagrant cloud. The error will look like:
Expand All @@ -90,17 +89,17 @@ Empty reply from server

Within your local vagrant boxes file, add:
```
centos7-katello-3.18-stable:
centos9-stream-katello-4.13-stable:
box_name: katello/katello-devel
box_version: 3.18.0
box_version: 4.13.0
```

changing 3.18.0 to the version you desire. Then:
changing 4.13.0 to the version you desire. Then:

```
vagrant up centos7-katello-3.18-stable
vagrant up centos9-stream-katello-4.13-stable
```

## Vagrant cloud usage

The centos7-katello-devel-stable box is [published to Vagrant cloud](https://app.vagrantup.com/katello/boxes/katello-devel) on a nightly basis to ensure an image with the latest changes is available. This box is only published if the Katello install is successful.
The centos9-katello-devel-stable box is [published to Vagrant cloud](https://app.vagrantup.com/katello/boxes/katello-devel) on a nightly basis to ensure an image with the latest changes is available. This box is only published if the Katello install is successful.
11 changes: 5 additions & 6 deletions packer/scripts/build_stable_dev_box.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ def write_json_file(json)
def print_message(version_string)
puts "========================="
puts "To try out this box:"
puts "# vagrant box add centos7-katello-#{version_string}-stable.box --name 'katello/katello-devel-#{version_string}-test' "
puts "# vagrant box add centos9-katello-#{version_string}-stable.box --name 'katello/katello-devel-#{version_string}-test' "
puts ""
puts "Use this box definition:"
puts "centos7-katello-#{version_string}-stable:"
puts "centos9-katello-#{version_string}-stable:"
puts " box_name: katello/katello-devel-#{version_string}-test"
puts " hostname: centos7-katello-devel-#{version_string}.example.com"
puts " hostname: centos9-katello-devel-#{version_string}.example.com"
puts ""
puts "To publish this box, run:"
puts "vagrant-upstream cloud publish -d \"katello-devel #{version_string}\" -s \"katello-devel #{version_string}\" katello/katello-devel #{version_string}.0 libvirt centos7-katello-#{version_string}-stable.box"
puts "vagrant-upstream cloud publish -d \"katello-devel #{version_string}\" -s \"katello-devel #{version_string}\" katello/katello-devel #{version_string}.0 libvirt centos9-katello-#{version_string}-stable.box"
end

katello_version = ARGV[0]
Expand All @@ -64,12 +64,11 @@ def print_message(version_string)
puts "Using configuration: #{json}"
filename = write_json_file(json)

command = "/usr/bin/packer build --var packer_hostname=centos7-katello-#{katello_version}-stable --var ansible_variables=\"@#{filename}\" centos7-katello-devel-stable.json"
command = "/usr/bin/packer build --var packer_hostname=centos9-katello-#{katello_version}-stable --var ansible_variables=\"@#{filename}\" centos9-katello-devel-stable.json"
puts "Running: #{command}"
if system(command)
print_message(katello_version)
else
puts "Build failed, see output above for more details."
exit -1
end

4 changes: 4 additions & 0 deletions pipelines/vars/common/foreman_nightly_centos9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
pipeline_type: foreman
pipeline_os: centos9-stream
pipeline_version: nightly
4 changes: 4 additions & 0 deletions pipelines/vars/common/katello_nightly_centos9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
pipeline_type: katello
pipeline_os: centos9-stream
pipeline_version: nightly
Loading

0 comments on commit a36d9ba

Please sign in to comment.