sooyean-hoo / puppetlabs-servicenow_cmdb_integration

Other
1 stars 0 forks source link

Refactor, extend and develop to integrate the GitHub Action CI with https://github.com/puppetlabs/cat-github-actions/tree/main/.github #11

Open sooyean-hoo opened 3 months ago

sooyean-hoo commented 3 months ago

Adjust the CI to make it 100% with https://github.com/puppetlabs/cat-github-actions/tree/main/.github

sooyean-hoo commented 2 months ago

Firstly, I am not the original author of the Acceptance Tests. It took me weeks to figure out what is the design and the original author's intentions. Have fun using 'git blame'.

The original Acceptance Test is using VMPooler... so it run the VMPooler to get a machine via SSH... as master. Inside the master, you run a mockup ServiceNow in a docker to test against. All acceptance tests are to be run on the master. VMPooler is now deprecated. Hence I am using vagrant to replace the VMPooler VM, using docker as a replacement has proven to be not working, as it is hard to have a docker within a docker container. In fact, it is impossible.

Now for the inner working of the tests. It is also silly to try to change the test to work with 2 containers: too much changes. The original author use litmus to only provision 1 VM: the master. The rest of the provision, the servicenow, it did it not via Litmus, but it still want to use it to manage and access the docker. This is where it is confusing. There is a 'servicenow_instance' in spec/support/acceptance/helpers.rb, magically created. It is not mentioned at all in provision.yaml. It is not created by the litmus, but a script. I would called it, as a way to hack the litmus. Hence it is as good as how litmus stay constant. If there is any future changes to how litmus ingest the inventory. It may just fail. Good LUCK.

sooyean-hoo commented 2 months ago

Also not sure why, when you provision a VM via Provision the module (for Vagrant, VirtualBox) or indirectly via Litmus, it provision you a VM which you cannot ssh into. I do not have time to study that. But it is just too stupid. In the end I had to write a bunch script to compensate.

sooyean-hoo commented 2 months ago

This module's original acceptance is poorly written. I would argue that it is totally not written.

The only acceptance ever written is for Ubuntu 16.04... using VMPool. Nothing else is considered..... Even though it is stated to work on a lot more. ref: https://github.com/sooyean-hoo/puppetlabs-servicenow_cmdb_integration/blob/a4c76f6b718ac9b9ee824324a904ece15b04432d/metadata.json#L24

  "operatingsystem_support": [
    {
      "operatingsystem": "CentOS",
      "operatingsystemrelease": [
        "7",
        "8"
      ]
    },
    {
      "operatingsystem": "OracleLinux",
      "operatingsystemrelease": [
        "7",
        "8"
      ]
    },
    {
      "operatingsystem": "RedHat",
      "operatingsystemrelease": [
        "7",
        "8"
      ]
    },
    {
      "operatingsystem": "Scientific",
      "operatingsystemrelease": [
        "7",
        "8"
      ]
    },
    {
      "operatingsystem": "Ubuntu",
      "operatingsystemrelease": [
        "18.04"
      ]
    },
    {
      "operatingsystem": "SLES",
      "operatingsystemrelease": [
        "12"
      ]
    }
  ]

The line which draw the conclusion that the acceptance is only for Ubuntu is @ here. https://github.com/sooyean-hoo/puppetlabs-servicenow_cmdb_integration/blob/a4c76f6b718ac9b9ee824324a904ece15b04432d/spec/support/acceptance/install_pe.sh#L8

The file install_pe.sh is used in all variant, hence all tests will failed for now, esp. even O/S Ubuntu 16.04 is not longer supported.

The task originally was to just to update the tests to bring it to date. However now it turned out to be a bigger task: writing test to work with all the missing O/S. about 10 of them. This is way more complicated, as there is also need to add more scenario and cater/reimplement for all old functions and original testing goals in the new O/S.

sooyean-hoo commented 2 months ago

Ubuntus' working as of https://github.com/sooyean-hoo/puppetlabs-servicenow_cmdb_integration/actions/workflows/ci_working.yml

sooyean-hoo commented 2 months ago
image
sooyean-hoo commented 2 months ago

https://github.com/sooyean-hoo/puppetlabs-servicenow_cmdb_integration/actions/runs/10669025799

image

sooyean-hoo commented 2 months ago

So now only Oracle Linux 7, RedHat Linux 7 and 8, Ubuntu 18.04, 20.04 and 22.04 are part of the testing Matrix. The exclusions and the reason for it are listed below. As an overview, there are a lot difficult in running the mock-up ServiceNow server. It is still run as a docker, but for Ubuntu, they are hosted in the PE Primary server. For others, they are hosted in the Runner. This is because I only managed to get docker to play nice in Ubuntu. And yes the Runner is also of Ubuntu. There are playful manipulation of port forwardings and /etc/hosts used to standardise the access to both the PE primary serverand themock-up ServiceNow server.