31d0565 Azure: Add support for testing multi IPA environments

24 files Authored by slev 4 years ago, Committed by abbra 4 years ago,
24 files changed. 585 lines added. 282 lines removed.
ipatests/azure/Dockerfiles/Dockerfile.build.fedoraipatests/azure/Dockerfile.build.fedora
file renamed
+0 -0
ipatests/azure/Dockerfiles/docker-compose.ymlipatests/azure/docker-compose.yml
file renamed
+1 -1
ipatests/azure/azure-pipelines.yml
file modified
+27 -41
ipatests/azure/azure-run-integration-tests.sh
file removed
-32
ipatests/azure/azure-run-tests.sh
file removed
-89
ipatests/azure/azure_definitions/base-fedora.yml
file added
+23
ipatests/azure/azure_definitions/base.yml
file added
+1
ipatests/azure/azure_definitions/gating-fedora.yml
file added
+84
ipatests/azure/azure_definitions/gating.yml
file added
+1
ipatests/azure/scripts/azure-run-base-tests.sh
file added
+96
ipatests/azure/scripts/azure-run-integration-tests.sh
file added
+29
ipatests/azure/scripts/azure-run-tests.sh
file added
+96
ipatests/azure/scripts/generate-matrix.py
file added
+41
ipatests/azure/scripts/setup_containers.pyipatests/azure/setup_containers.py
file renamed
+19 -15
ipatests/azure/scripts/variables-fedora.sh
file added
+7
ipatests/azure/scripts/variables.sh
file added
+14
ipatests/azure/templates/generate-job-variables.yml
file added
+21
ipatests/azure/templates/generate-matrix.yml
file added
+9
ipatests/azure/templates/publish-build.yml
file modified
+9 -10
ipatests/azure/templates/run-test.yml
file modified
+53 -34
ipatests/azure/templates/save-test-artifacts.yml
file modified
+3 -2
ipatests/azure/templates/setup-test-environment.yml
file modified
+11 -35
ipatests/azure/templates/test-jobs.yml
file modified
+35 -22
ipatests/azure/templates/variables-common.yml
file modified
+5 -1
    Azure: Add support for testing multi IPA environments
    
    Currently, only one IPA environment is tested within Docker
    containers. This is not efficient because Azure's agent gives
    6 GB of physical memory and 13 GB of total memory (Feb 2020),
    but limits CPU with 2 cores.
    
    Next examples are for 'master-only' topologies.
    
    Let's assume that only one member of github repo simultaneously
    run CI. This allows to get the full strength of Azure.
    
    Concurrency results for TestInstallMaster:
    ------------------------------------------
    |    job concurrency      |  time/jobs   |
    ------------------------------------------
    |             5           |     40/5     |
    |             4           |     34/4     |
    |             3           |     25/3     |
    |             2           |     19/2     |
    |             1           |     17/1     |
    ------------------------------------------
    Results prove the limitation of 2 cores. So, in case of jobs'
    number not exceeds the max capacity for parallel jobs(10) the
    proposed method couldn't save time, but it reduces the used
    jobs number up to 2 times. In other words, in this case CI
    could pass 2 x tests.
    
    But what if CI was triggered by several PRs? or jobs' number is
    bigger than 10. For example, there are 20 tests to be run.
    
    Concurrency results for TestInstallMaster and 20 input jobs:
    ------------------------------------------------------------------
    |    job concurrency      |     time     | jobs used | jobs free |
    ------------------------------------------------------------------
    |             5           |      40      |      4    |     6     |
    |             4           |      34      |      5    |     5     |
    |             3           |      25      |      7    |     3     |
    |             2           |      19      |     10    |     0     |
    |             1           |      34      |     20    |     0     |
    ------------------------------------------------------------------
    So, in this case the optimal concurrency would be 4 since it
    allows to run two CIs simultaneously (20 tasks on board) and get
    results in 34 minutes for both. In other words, two people could
    trigger CI from PR and don't wait for each other.
    
    New Azure IPA tests workflow:
    
    + 1) generate-matrix.py script generates JSON from user's YAML [0]
      2) Azure generate jobs using Matrix strategy
      3) each job is run in parallel (up to 10) within its own VM (Ubuntu-18.04):
        a) downloads prepared Docker container image (artifact) from Azure cloud
           (built on Build Job) and loads the received image into local pool
      + b) GNU 'parallel' launch each IPA environment in parallel:
        + 1) docker-compose creates the Docker environment having a required number
             of replicas and/or clients
        + 2) setup_containers.py script does the needed container's changes (DNS,
             SSH, etc.)
        + 3) launch IPA tests on tests' controller
        c) publish tests results in JUnit format to provide a comprehensive test
           reporting and analytics experience via Azure WebUI [1]
        d) publish regular system logs as artifacts
    
    [0]: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=yaml
    
    Fixes: https://pagure.io/freeipa/issue/8202
    Signed-off-by: Stanislav Levin <slev@altlinux.org>
    Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
    
        
ipatests/azure/Dockerfiles/Dockerfile.build.fedora ipatests/azure/Dockerfile.build.fedora
file renamed
file was renamed with no change to the file
ipatests/azure/Dockerfiles/docker-compose.yml ipatests/azure/docker-compose.yml
file renamed
+1 -1
ipatests/azure/scripts/setup_containers.py ipatests/azure/setup_containers.py
file renamed
+19 -15