Commit Graph

2545 Commits

Author SHA1 Message Date
Thomas Woerner
8d74fe34ef Enable c10s testing for PRs and nightly and after merge testing 2024-12-02 15:38:39 +01:00
Thomas Woerner
87ad46f7a4 Enable to build c10s test container image 2024-12-02 15:11:48 +01:00
Thomas Woerner
4c3f4e6f7d infra/image: Use SYS_ADMIN capability for server deployment
This adds the capabilities SYS_ADMIN and SYSLOG to the container_create
call in build.sh as long as server deployment has been enabled.

The privileged option has been removed as it is no longer needed.

The hostnamectl-wrapper for the container has been removed as it is no
longer needed.
2024-12-02 15:06:44 +01:00
Rafael Guterres Jeffman
489f4d5784 Merge pull request #1316 from t-woerner/c10s_niddomainname
infra/image/dockerfile/c10s: Fix client part deployment for the server
2024-11-29 08:39:21 -03:00
Rafael Guterres Jeffman
29fc03c625 Merge pull request #1315 from t-woerner/container_copy_fetch
infra/image/shcontainer: New container_copy and container_fetch
2024-11-28 11:02:44 -03:00
Rafael Guterres Jeffman
651337541a Merge pull request #1317 from t-woerner/minimum_ansible_2_14
Change minimum Ansible version to 2.14
v1.14.1
2024-11-26 10:16:04 -03:00
Thomas Woerner
e61b8db66c Change minimum Ansible version to 2.14
RHEL-9 is still using ansible-core 2.14.
2024-11-26 11:56:24 +01:00
Thomas Woerner
2dc1deeb87 infra/image/dockerfile/c10s: Fix client part deployment for the server
The client part deployment fails in the configuration of NIS. The command
/usr/bin/nisdomainname is failing in a container in this task as the
container is not privileged.

The hostnamectl-wrapper is copied from the freeipa-container container
project to replace /usr/bin/nisdomainname in the container.
2024-11-19 15:54:03 +01:00
Thomas Woerner
82a53b9ae4 infra/image/shcontainer: New container_copy and container_fetch
container_copy can be used to copy a file to the container,
container_fetch can be used to copy a file from the container.

For more information, please have a look at the podman-cp man page.
2024-11-19 15:08:46 +01:00
Thomas Woerner
d580431832 Merge pull request #1290 from rjeffman/multiple_sudorule
ipasudorule: Add support for batch mode and multiple sudorules
v1.14.0
2024-11-19 14:55:40 +01:00
Rafael Guterres Jeffman
6c94fe9bd5 tests/sudorule: Don't become or gather_facts and use only true/false
Unless there's a real need to use privileged access or to gather Ansible
facts upfront, we should always set "become: false" and
"gather_facts: false". In the case that only a few Ansible facts are
required, 'ansible.builtin.setup' with 'gather_subset' should be used.

As the YAML 1.2 standard dictates, boolean values should only use 'true'
or 'false' values.

This patch fixes these issues in the 'sudorule' test suite.
2024-11-18 11:59:51 -03:00
Rafael Guterres Jeffman
4fa0621156 ipasudorule: Add support for batch mode and multiple sudorules
Currently, ipasudorule must add or modify a single sudorule at a time,
incurring in more load in the server if there are many rules to be
processed.

This patch adds suport for adding multiple sudorules in one playbook
task by using the parameter 'sudorules' and defining a list of sudorules
configurations to be ensured.

As multiple sudorules will be processed, the patch also enables batch
mode processing of sudorules, trying to reduce the load on the server.

Test 'tests/sudorule/test_sudorule_client_context.yml' was modified to
include tasks with 'sudorules' to be executed both on the server or on
the client context.

New tests were added to the sudorule test suite:

    tests/sudorule/test_sudorules.yml
    tests/sudorule/test_sudorules_member_case_insensitive.yml
2024-11-18 11:59:21 -03:00
Rafael Guterres Jeffman
da775a21b2 ansible_freeipa_module_utils: Add EntryFactory class
This patch adds the class EntryFactory to the ansible-freeipa module
utils. This class allows the handling of modules with multiple object
entries as list of objects. When the multi-object parameter is not used,
it creates a list of a single object, allowing for the same code idiom
to be used.

The entries created can be used both as objects, by acessing the values
as properties, or as dictionaires, by accessing the elements as
key-value pairs.
2024-11-15 08:43:19 -03:00
Thomas Woerner
5a774d2612 Merge pull request #1306 from rjeffman/use_azure_loops
upstream CI: Use Azure 'loops' to create stages
2024-11-13 16:24:29 +01:00
Rafael Guterres Jeffman
3e405fd08d upstream CI: Use Azure 'loops' to create stages
This patch modify the pipelines to create stages using the 'each'
expression on Azure pipelines, so that the configuration and the list of
distributions can be set using variables.

Testing CentOS 8 Stream and Galaxy collections still need to be handled
in a separate group, although, the pipeline configuration becomes easily
changed, specially when updating Ansible versions.
2024-11-13 11:08:36 -03:00
Thomas Woerner
cb3226910b Merge pull request #1311 from rjeffman/consistent_cli_arguments
infra/image/build.sh: Use consistent options for hostname
2024-11-12 12:45:30 +01:00
Rafael Guterres Jeffman
a96611fb3f infra/image/build.sh: Use consistent options for hostname
This patch makes the CLI argument for setting the image hostname
consistent with 'start.sh', settling on '-n HOSTNAME' for both scripts.
2024-11-12 08:35:46 -03:00
Thomas Woerner
e92f09b920 Merge pull request #1308 from rjeffman/mv_set_test_modules
upstream CI: Move scripts that evaluate repo changes to infra/azure
2024-11-07 10:14:50 +01:00
Thomas Woerner
97b0638f30 Merge pull request #1310 from rjeffman/remove_pydocstyle
linters: Remove pydocstyle from linter checks
2024-11-07 10:04:21 +01:00
Rafael Guterres Jeffman
24569b850a linters: Remove pydocstyle from linter checks
Pydocstyle has been deprecated is no longer in development. It is also
not a requirement for Ansible tests.

This patch removes pydocstyle from current checks performed.
2024-11-06 15:15:53 -03:00
Rafael Guterres Jeffman
08a2ba1592 Merge pull request #1281 from t-woerner/multi_user_test_generate_test_data
tests/user/test_users_present_*: Use new generate_test_data.yml
2024-11-04 14:19:19 -03:00
Rafael Guterres Jeffman
3d5ff1f5fd Merge pull request #1298 from t-woerner/fixipaip_no_hard_coded_adminpassword
fixipaip infra image service: No need for hard coded admin password
2024-11-04 14:09:00 -03:00
Rafael Guterres Jeffman
2b28626012 Merge pull request #1275 from t-woerner/drop_superfluous_test_services_absent
test_services_absent is also part of test_services_present, not needed
2024-11-04 14:06:58 -03:00
Thomas Woerner
7c7d98872e Merge pull request #1309 from rjeffman/update_fedora_41
Update images to Fedora 41
2024-11-04 15:38:15 +01:00
Rafael Guterres Jeffman
8956a7a1dd build images: Force use --privileged on containers
Deploying FreeIPA in the testing containers requires privileged access.
2024-11-04 11:21:08 -03:00
Rafael Guterres Jeffman
25577fa9bc build images: Update images for Fedora 41
Fedora has released version 41, which was the previous 'rawhide'
version, and now the 'fedora-latest' requires dnf5 related packages.
2024-11-04 11:21:08 -03:00
Rafael Guterres Jeffman
f6bd62feb4 upstream CI: Move scripts that evaluate repo changes to infra/azure
All scripts related to the Azure CI now reside on inrfa/azure, but the
scripts that evaluate the changes made against ansible-freeipa's main
development branch.

This patch move these scripts to the proper locations.
2024-10-31 19:17:20 -03:00
Thomas Woerner
33c1c00643 Merge pull request #1300 from rjeffman/update_upstream_ci
Fix upstream CI and remove molecule
2024-10-31 15:23:41 +01:00
Rafael Guterres Jeffman
0f530df092 upstream CI: Update Ansible version
ansible-core versions 2.15 and 2.16 and used for all pipelines, but
version 2.17 is not used for CentOS 8 Stream, as platform python on
this version is 3.6 which is not supported in this ansible-core version.
2024-10-31 11:06:41 -03:00
Rafael Guterres Jeffman
a707d1887d upstream CI: Use Ubuntu 24.04 to build test images 2024-10-31 11:06:41 -03:00
Rafael Guterres Jeffman
e1786c9ddc upstream CI: Enable creation of CentOS 10 Stream images 2024-10-31 11:06:41 -03:00
Rafael Guterres Jeffman
367d30a30c upstream CI: Simplify pipelines enviroment creation
Several optimizations have been done to the pipelines, to make them
closer to what can be reproduced, with the existing scripts, in a
development environment:

- Use start.sh and build.sh scripts to build and start containers
- Use variables to configure different stages instead of using separate
  files
- Use a commom 'prepare_environment' to create the environment for every
  pipeline
- Use a single file defining testing steps (run_tests.yml)
- Remove Centos 7 pipelines
- Reduce the number of pipelines in the test matrix due to the amount of
  time that tests were using
- Use Azure "loop" (each) to create test groups

The above changes make the pipelines easier to understand and modify.
2024-10-31 11:06:41 -03:00
Rafael Guterres Jeffman
77c34aeca2 upstream ci: Move Azure scripts to infra directory
Move Azure scripts to infra directory, as only roles and modules test
playbooks should exist in the tests directory.
2024-10-31 11:06:41 -03:00
Rafael Guterres Jeffman
5b33cb5e80 Remove molecule dependencies
For some time now, we had some issues with molecule when building test
images for ansible-freeipa, and replaced the image creation with custom
build scripts that use commom container tools (like Dockerfiles and the
build command).

As there's no more tasks that require the use of molecule, this patch
removes the last bits used by it, and fixes documentation and lint
scripts and configuration.
2024-10-31 11:06:41 -03:00
Rafael Guterres Jeffman
c979843b1a upstream CI: Allow podman options when creating containers
When using containers to test ansible-freeipa there's a need to deal
with 'podman' the development environment and the Azure environment. In
the Azure environment, with Ubuntu hosts, using 'cap-add' does not allow
FreeIPA to be installed on the containers, and they need to be executed
with privileged mode. On the other hand, on development environments,
such as recent Fedora hosts, there's no need to run the container with
extra privileges.

This patch modifies the utility function 'container_create' to allow the
usage of key-value argumes such as "cpus=4" and "privileged", that will
be used in the container creation.

The currently available options are "privileged", "cpus", "memory" and
"hostname". By default "cpus=2" and "hostname=ipaserver.test.local".

Also, too make the image build script more self-contained, if the
required Ansible collections are not installed, they will be temporarily
installed so that the image can be built.
2024-10-31 11:06:41 -03:00
Rafael Guterres Jeffman
a8ce235261 utils/set_test_modules: Allow to ignore Git differences
To force setting the IPA_ENABLE_* variables to run all tests, source the
script using '-I' or set the environment variable SKIP_GIT_TESTS to
'True'.

This will allow the correct selection of Azure pipelines tests to be
based on a single environment variable, what will reduce the number of
test running templates to a singe file.
2024-10-30 16:40:26 -03:00
Thomas Woerner
bdcc8153f8 Merge pull request #1305 from rjeffman/ipacert_testfix_key_size
ipacert: Fix ipacert tests
2024-10-30 14:15:38 +01:00
Rafael Guterres Jeffman
57bc35df80 ipacert: Fix ipacert tests
It seems that in recent versions, a minimum of 2048 bits for RSA keys
are required to request a certificate. This seems to be enforced by
crypto policies.

By adjusting the key size all ipacert tests pass.
2024-10-30 08:19:53 -03:00
Thomas Woerner
a2f59e1a34 Merge pull request #1285 from offdutypirate/fix-doc-typos
fix minor typo in hbacrule and hbacsvcgroup docs
2024-10-14 13:08:49 +02:00
Rafael Guterres Jeffman
16636de681 Merge pull request #1268 from t-woerner/ipauser_use_date_string
ipauser: Use date string, not datetime object for expiration dates
2024-10-11 15:30:01 -03:00
Thomas Woerner
55ec25a759 ipauser: Use date string, not datetime object for expiration dates
So far a datetime object was created for the expiration dates
krbpasswordexpiration and krbprincipalexpiration. This resulted in also
sending these objects to the API. With this change, the dates are
converted into strings using the LDAP_GENERALIZED_TIME_FORMAT defined in
ipalib.constants. This way only strings are used with the IPA API.

A new function has been added to ansible_freeipa_module:

- date_string: Convert datetime to gernalized time format string

This fuction is used on the result of user_show to convert the
expiration dates to the gernalized time format string.

The existing function date_format in ansible_freeipa_module has been
renamed to convert_date and fixed in the way that it also uses
date_string to return a gernalized time format string and not a
datetime object. This function was only used in the ipauser module so
far.
2024-10-11 15:52:02 +02:00
Thomas Woerner
2b10256575 test_services_absent is also part of test_services_present, not needed
This test is not needed as it is already part of test_services_present.
2024-10-11 15:51:39 +02:00
Thomas Woerner
907650c746 tests/user/test_users_present_*: Use new generate_test_data.yml
The new generate_test_data.yml is creating the test data with
ansible.builtin.shell and is not calling shell scripts any more. The
generation in the yml file and also the set_fact calls make sure that
the test data is used.
2024-10-11 15:51:14 +02:00
Thomas Woerner
b128a5cb9f fixipaip infra image service: No need for hard coded admin password
The admin password is not needed for the system service as it running
as root. The use of `-e in_server=true` is sufficient for all ipa calls.
2024-10-11 15:50:09 +02:00
Rafael Guterres Jeffman
220c4f0016 Merge pull request #1299 from t-woerner/pylint_github_workflow_disable_too-many-positional-arguments
pylint gihub workflow: Disable too-many-positional-arguments
2024-10-11 10:27:52 -03:00
Thomas Woerner
7f1df9d8f8 pylint gihub workflow: Disable too-many-positional-arguments
This change disables the too-many-positional-arguments message for the
pylint github workflow.
2024-10-11 14:48:59 +02:00
Rafael Guterres Jeffman
75d8ea283f Merge pull request #1292 from t-woerner/new_infra_image_start
New infra image start
2024-10-08 18:56:58 -03:00
Thomas Woerner
91a3013513 Add ansible-freeipa-tests inventory using podman
This inventory file is usable for the containers started with
infra/image/start.sh.
2024-10-02 13:44:09 +02:00
Thomas Woerner
85ef81c842 infra/image/system-service/fixipaip.sh: Behave idempotent
This makes sure that the service is not failing on already applied
modifications.
2024-10-02 13:44:09 +02:00
Thomas Woerner
ad44f11887 infra/image/build.sh: "-s" help fix and cleanup
The help has been fixed for the -s option and the comments about how to
start the container later on has been removed as there will be a script
that is handling this..
2024-10-02 13:44:09 +02:00