From 1c577ea3b4f189abb554a241616d75ab5a47dd66 Mon Sep 17 00:00:00 2001 From: Kiefer Chang Date: Tue, 2 Jan 2024 09:00:48 +0800 Subject: [PATCH] ci: remove Jenkins job scripts Signed-off-by: Kiefer Chang (cherry picked from commit c7f6b5da5a3f959dbf4e232ee6cd577ae2127b91) --- ci/README.md | 56 --------- ci/run_vagrant_install_test.yml | 197 -------------------------------- 2 files changed, 253 deletions(-) delete mode 100644 ci/README.md delete mode 100644 ci/run_vagrant_install_test.yml diff --git a/ci/README.md b/ci/README.md deleted file mode 100644 index 57409315e..000000000 --- a/ci/README.md +++ /dev/null @@ -1,56 +0,0 @@ -Harvester-installer CI Job Scripts -================================== - -Introduction ------------- - -This directory containers the [Ansible] playbook for harvester-installer CI -job. The harvester-installer CI job is responsible for validating the pull -requests (for the harvester-installer repo) by performing the following: - -1. checkout the given pull request -2. build the artifacts (i.e. ISO, ramdisk, kernel, and rootfs) by running the - `make` command -3. test the newly built artifacts in the [Harvester Vagrant iPXE] environment -4. post the test result to the pull request - -Jenkins -------- - -The harvester-installer CI job is running on [Jenkins], which is accessible by -either clicking on the `Details` link next to the `Vagrant installation testing` -check job from the pull request, or explicitly via -`https://ci.harvesterhci.io/job/harvester-vagrant-installation-test//`. -Though anonymouse access is disabled, developers can login as -`harvester/harvester030` to view the job result. - -**NOTE:** developers only read access to the job. - -Run The Job Locally -------------------- - -Though the Ansible playbook is meant to be used by CI, you one can run it -locally as desire. To run it locally, make sure the following variables are -sepcified. - -* `WORKSPACE`: this should point to the parent dir of the harvester-installer - directory. -* `PR_ID`: pull request ID - -**WARNING:** the playbook will clone the `harvester/ipxe-examples` repository -under the `WORKSPACE` directory. If you already have `harvester/ipxe-examples' -checked out, make sure to move it out of the way so it won't get overwritten. -Also, make sure your host satisfy the minimal requirements specified in -https://github.com/harvester/ipxe-examples/tree/main/vagrant-pxe-harvester#prerequisites -You can install the latest version of [Ansible] via [Python PIP]. - -To run the job locally: - -1. Checkout the pull request branch. -2. `ansible-playbook -e WORKSPACE= -e PR_ID= run_vagrant_install_test.yml` - - -[Ansible]: https://www.ansible.com/ -[Harvester Vagrant iPXE]: https://github.com/harvester/ipxe-examples/tree/main/vagrant-pxe-harvester -[Jenkins]: https://www.jenkins.io/ -[Python PIP]: https://pip.pypa.io/en/stable/ diff --git a/ci/run_vagrant_install_test.yml b/ci/run_vagrant_install_test.yml deleted file mode 100644 index 39f977d29..000000000 --- a/ci/run_vagrant_install_test.yml +++ /dev/null @@ -1,197 +0,0 @@ ---- -- name: Run Vagrant Harvester Installation Test - hosts: localhost - connection: local - gather_facts: false - - vars: - REPO: "{{ harvester_installer_repo_name | default('harvester/harvester-installer') }}" - - tasks: - - name: Make sure WORKSPACE is defined - fail: - msg: "Variable WORKSPACE is not defined." - when: WORKSPACE is not defined - - - name: Check for harvester-installer - stat: - path: "{{ WORKSPACE }}/harvester-installer" - register: harvester_installer_dir_check_result - - - name: Make sure harvester-installer directory exist - fail: - msg: "{{ WORKSPACE }}/harvester-installer not found" - when: not harvester_installer_dir_check_result.stat.exists - - - name: Build harvester-installer artifacts - shell: > - make - args: - chdir: "{{ WORKSPACE }}/harvester-installer" - retries: 5 - delay: 20 - register: shell_result - until: shell_result.rc == 0 - - - name: Check for existing environment - stat: - path: "{{ WORKSPACE }}/ipxe-examples" - register: check_ipxe_examples_result - - - name: Cleanup vagrants - shell: > - vagrant destroy -f --parallel - args: - chdir: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-harvester" - when: check_ipxe_examples_result.stat.exists - - - name: Cleanup ipxe-examples dir - file: - path: "{{ WORKSPACE }}/ipxe-examples" - state: absent - - - name: Clone ipxe-examples repo - git: - repo: https://github.com/harvester/ipxe-examples.git - version: main - dest: "{{ WORKSPACE }}/ipxe-examples" - - - name: Check to see if "/usr/share/qemu/OVMF.fd" exist - stat: - path: /usr/share/qemu/OVMF.fd - register: file_ovmf_fd_check_result - - - name: Remove OVMF.fd line if needed - lineinfile: - path: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-harvester/Vagrantfile" - regexp: '.*\/OVMF\.fd.*' - state: absent - when: not file_ovmf_fd_check_result.stat.exists - - - name: Generate the SSH key - vars: - ssh_key_filename: "{{ WORKSPACE }}/harvester-installer/ci/terraform/tmp-ssh-key" - openssh_keypair: - path: "{{ ssh_key_filename }}" - type: rsa - size: 3072 - state: present - force: no - - - name: Set SSH Key - vars: - generated_ssh_key: "{{ lookup('file', '{{ WORKSPACE }}/harvester-installer/ci/terraform/tmp-ssh-key.pub') }}" - settings_file: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-harvester/settings.yml" - shell: yq e -i ".harvester_config.ssh_authorized_keys += [\"{{ generated_ssh_key }}\"]" "{{ settings_file }}" - - - name: Set harvester_iso_url - replace: - path: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-harvester/settings.yml" - regexp: "^harvester_iso_url:.*" - replace: "harvester_iso_url: file://{{ WORKSPACE }}/harvester-installer/dist/artifacts/harvester-master-amd64.iso" - - - name: Set harvester_kernel_url - replace: - path: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-harvester/settings.yml" - regexp: "^harvester_kernel_url:.*" - replace: "harvester_kernel_url: file://{{ WORKSPACE }}/harvester-installer/dist/artifacts/harvester-master-vmlinuz-amd64" - - - name: Set harvester_ramdisk_url - replace: - path: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-harvester/settings.yml" - regexp: "^harvester_ramdisk_url:.*" - replace: "harvester_ramdisk_url: file://{{ WORKSPACE }}/harvester-installer/dist/artifacts/harvester-master-initrd-amd64" - - - name: Set harvester_rootfs_url - replace: - path: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-harvester/settings.yml" - regexp: "^harvester_rootfs_url:.*" - replace: "harvester_rootfs_url: file://{{ WORKSPACE }}/harvester-installer/dist/artifacts/harvester-master-rootfs-amd64.squashfs" - - - name: Run setup Harvester - shell: > - ./setup_harvester.sh - register: setup_harvester_result - args: - chdir: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-harvester" - ignore_errors: yes - - - name: Print Harvester installation output - debug: - msg: "{{ setup_harvester_result.stdout_lines }}" - - - name: Enable software-emulation in KubeVirt - register: kubevirt_result - vars: - settings_file: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-harvester/settings.yml" - shell: > - ./enable_soft_emulation.sh {{ settings_file }} - args: - chdir: "{{ WORKSPACE }}/harvester-installer/ci/terraform" - - - name: Print Enable software-emulation in KubeVirt output - debug: - msg: "{{ kubevirt_result.stdout_lines }}" - - - name: Clear the previous temp file - shell: > - ./cleanup_test_files.sh - args: - chdir: "{{ WORKSPACE }}/harvester-installer/ci/terraform" - - - name: Testing existing files - vars: - settings_file: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-harvester/settings.yml" - shell: > - ./check_files.sh {{ settings_file}} - args: - chdir: "{{ WORKSPACE }}/harvester-installer/ci/terraform" - - - name: Testing services status - vars: - settings_file: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-harvester/settings.yml" - shell: > - ./check_services_status.sh {{ settings_file}} - args: - chdir: "{{ WORKSPACE }}/harvester-installer/ci/terraform" - - - name: Testing basic operations with terraform - register: terraform_test - vars: - settings_file: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-harvester/settings.yml" - shell: | - curl https://releases.hashicorp.com/terraform/1.3.7/terraform_1.3.7_linux_amd64.zip -o terraform_bin.zip - unzip -o terraform_bin.zip - ./get_kubeconfig.sh {{ settings_file }} - ./terraform init -no-color - ./terraform apply -auto-approve -no-color - args: - chdir: "{{ WORKSPACE }}/harvester-installer/ci/terraform" - - - name: Print terraform output - debug: - msg: "{{ terraform_test.stdout_lines }}" - - - name: Test network on the VMs - register: network_test - vars: - settings_file: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-harvester/settings.yml" - shell: | - ./test_terraform_vm.sh {{ settings_file }} - args: - chdir: "{{ WORKSPACE }}/harvester-installer/ci/terraform" - - - name: Print network testing output - debug: - msg: "{{ network_test.stdout_lines }}" - - - name: Cleanup Harvester Vagrant VMs - shell: > - vagrant destroy -f - args: - chdir: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-harvester" - - - name: Check result - fail: - msg: "ERROR: {{ setup_harvester_result.stderr }}" - when: setup_harvester_result.failed