Skip to content

Commit

Permalink
Add testing farm github action
Browse files Browse the repository at this point in the history
  • Loading branch information
majamassarini committed Jul 5, 2024
1 parent b77b10c commit 4cab4d4
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 1 deletion.
34 changes: 34 additions & 0 deletions .github/workflows/tf-tests.yml
Original file line number Diff line number Diff line change
@@ -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 }}
16 changes: 16 additions & 0 deletions plans/deployment.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 4 additions & 1 deletion playbooks/oc-cluster-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down
7 changes: 7 additions & 0 deletions playbooks/test_deploy_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down

0 comments on commit 4cab4d4

Please sign in to comment.