diff --git a/.github/workflows/tf-tests.yml b/.github/workflows/tf-tests.yml new file mode 100644 index 0000000..05453e7 --- /dev/null +++ b/.github/workflows/tf-tests.yml @@ -0,0 +1,34 @@ +name: Schedule test on Testing Farm +on: + pull_request: +# on: +# issue_comment: +# types: +# - created + +# The concurrency key is used to prevent multiple workflows from running at the same time +concurrency: + group: my-concurrency-group + cancel-in-progress: true + +jobs: + tests: + runs-on: ubuntu-latest + # if: | + # github.event.issue.pull_request + # && contains(github.event.comment.body, '[test]') + # && contains(fromJson('["OWNER", "MEMBER"]'), github.event.comment.author_association) + steps: + - name: Schedule test on Testing Farm + uses: sclorg/testing-farm-as-github-action@v2 + with: + compose: CentOS-Stream-9 + api_key: ${{ secrets.TF_API_KEY }} + git_url: "https://github.com/packit/deployment" + git_ref: "tf-openshift-tests" + tmt_plan_regex: "deployment/remote" + tmt_hardware: '{"memory": ">= 13 GiB", "disk": [{"size": ">= 100 GB"}], "cpu": {"cores": ">= 6"}, "virtualization": {"is-supported": true}}' + pull_request_status_name: "Deployment" + create_issue_comment: true + timeout: 3600 + secrets: CRC_PULL_SECRET=${{ secrets.CRC_PULL_SECRET }} diff --git a/plans/deployment.fmf b/plans/deployment.fmf index 39ba7bb..83d9726 100644 --- a/plans/deployment.fmf +++ b/plans/deployment.fmf @@ -15,6 +15,22 @@ discover: test: - deployment +/remote: + summary: Run packit-service deployment test on a remote testing-farm machine (details are defined in the GitHub action) + prepare: + - how: ansible + playbook: playbooks/oc-cluster-user.yml + extra-args: '-vvv' + - how: ansible + playbook: playbooks/oc-cluster-setup.yml + extra-args: '-vvv' + - how: ansible + playbook: playbooks/oc-cluster-run.yml + extra-args: '-vvv' + - how: ansible + playbook: playbooks/oc-cluster-tests-setup.yml + extra-args: '-vvv' + /local: summary: Run packit-service deployment test on a local machine managed by tmt discover: diff --git a/playbooks/oc-cluster-run.yml b/playbooks/oc-cluster-run.yml index f9bba11..ac2e5c2 100644 --- a/playbooks/oc-cluster-run.yml +++ b/playbooks/oc-cluster-run.yml @@ -5,10 +5,13 @@ become_user: tmt gather_facts: False vars: - pull_secret: "!!!TAKEN FROM ANSIBLE ENV!!!" dest_pull_secret_file: /tmp/openshift-local-pull-secret.txt crc_path: /home/tmt/.local/bin tasks: + - name: Look for pull_secret in env vars if it is not already defined + ansible.builtin.set_fact: + pull_secret: "{{ lookup('env', 'CRC_PULL_SECRET') }}" + when: pull_secret is undefined - name: Show pull secret ansible.builtin.debug: msg: "{{ pull_secret }}" diff --git a/playbooks/test_deploy_setup.yml b/playbooks/test_deploy_setup.yml index b9567ce..8fe35f6 100644 --- a/playbooks/test_deploy_setup.yml +++ b/playbooks/test_deploy_setup.yml @@ -75,6 +75,13 @@ owner: tmt directory_mode: "0755" + - name: Copy secrets that are already been generated in tmt home # noqa risky-file-permissions # this is a recursive copy + ansible.builtin.copy: + src: "../secrets" + dest: /home/tmt/deployment + owner: tmt + directory_mode: "0755" + - name: Create packit/dev.yml ansible.builtin.copy: content: |