Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add a mutation action plugin #89

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

yusufhm
Copy link
Contributor

@yusufhm yusufhm commented Jul 19, 2024

DEVOPS-551

  • Adds support for running dynamic mutations against the GraphQL api.

This allows the following type of playbook:

- name: Test mutation
  hosts: localhost
  connection: local
  gather_facts: false
  become: false
  tasks:
    - name: Fetch a Lagoon token.
      lagoon.api.token:
        ssh_options: "-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
      register: token
    - ansible.builtin.set_fact:
        lagoon_token: "{{ token.token }}"
        lagoon_api_token: "{{ token.token }}"

    - name: Delete a Fact via mutation before creating
      lagoon.api.mutation:
        mutation: deleteFact
        input:
          environment: "{{ environment_id }}"
          name: test_module

    - name: Create a Fact via mutation
      lagoon.api.mutation:
        mutation: addFact
        input:
          name: test_module
          category: Drupal Module Version
          environment: "{{ environment_id }}"
          value: 2.0.0
          source: ansible_playbook:test-mutation
          description: The test_module module version
        select: Fact
        subfields:
          - id

    - name: Delete Facts from a source via mutation before creating
      lagoon.api.mutation:
        mutation: deleteFactsFromSource
        input:
          environment: "{{ environment_id }}"
          source: ansible_playbook:test-mutation

    - name: Create Facts via mutation
      lagoon.api.mutation:
        mutation: addFactsByName
        input:
          project: test-project
          environment: master
          facts:
            - name: test2_module
              category: Drupal Module Version
              value: 2.0.0
              source: ansible_playbook:test-mutation
              description: The test2_module module version
            - name: test3_module
              category: Drupal Module Version
              value: 2.0.0
              source: ansible_playbook:test-mutation
              description: The test3_module module version
        select: Fact
        subfields:
          - id

[DEVOPS-551]
- Adds support for running dynamic mutations against the GraphQL api.
@yusufhm yusufhm requested a review from steveworley July 19, 2024 12:30
@yusufhm yusufhm self-assigned this Jul 19, 2024
@yusufhm yusufhm merged commit 33ad531 into master Jul 19, 2024
6 checks passed
@yusufhm yusufhm deleted the feature/DEVOPS-551-mutation-plugin branch July 19, 2024 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant