Skip to content

Problem: Variables not passed downstream in Workflows #4229

Description

@reggienatr

Issue

Hello,

I'm tinkering with the 'Workflows' functionality but I'm not getting the variables to pass downstream.
To my understanding this was added in version 2.18 based on the roadmap:
https://semaphoreui.com/roadmap/workflows#7.4-variable-passing-between-nodes

Reading the documentation, setting variables with 'set_stats' should automatically pass them downstream, but I'm not able to reference the variable in my downstream nodes.

From docs https://semaphoreui.com/docs/sr/user-guide/workflows#workflow-artifacts-set_stats
"When an Ansible task in a workflow uses set_stats, the variables are stored as workflow artifacts for that run. Downstream task nodes in the same run receive them as extra variables automatically."

Impact

Ansible (task execution)

Installation method

Docker

Database

MySQL

Browser

No response

Semaphore Version

v2.19.14-7d1872e-1788945498

Ansible Version

ansible [core 2.20.9]


# /opt/semaphore/apps/ansible/13.5.0/venv/lib/python3.12/site-packages/ansible/_internal/ansible_collections
Collection                               Version
---------------------------------------- -------
ansible._protomatter                     *

# /opt/semaphore/apps/ansible/13.5.0/venv/lib/python3.12/site-packages/ansible_collections
Collection                               Version
---------------------------------------- -------
amazon.aws                               10.3.0
ansible.netcommon                        8.4.0
ansible.posix                            2.1.0
ansible.utils                            6.0.1
ansible.windows                          3.5.0
arista.eos                               12.0.1
awx.awx                                  24.6.1
azure.azcollection                       3.16.0
check_point.mgmt                         6.9.0
chocolatey.chocolatey                    1.5.3
cisco.aci                                2.13.0
cisco.dnac                               6.48.0
cisco.intersight                         2.16.0
cisco.ios                                11.3.0
cisco.iosxr                              12.1.1
cisco.meraki                             2.23.1
cisco.mso                                2.13.0
cisco.nxos                               11.1.3
cisco.ucs                                1.16.0
cloudscale_ch.cloud                      2.5.3
community.aws                            10.1.0
community.ciscosmb                       1.0.11
community.clickhouse                     2.1.0
community.crypto                         3.1.1
community.dns                            3.5.3
community.docker                         5.1.0
community.general                        12.5.0
community.grafana                        2.3.0
community.hashi_vault                    7.1.0
community.hrobot                         2.7.1
community.library_inventory_filtering_v1 1.1.5
community.libvirt                        2.1.0
community.mongodb                        1.7.12
community.mysql                          4.2.0
community.okd                            5.0.0
community.postgresql                     4.2.0
community.proxmox                        1.6.0
community.proxysql                       1.7.0
community.rabbitmq                       1.6.0
community.routeros                       3.18.0
community.sap_libs                       1.7.0
community.sops                           2.2.7
community.vmware                         6.2.0
community.windows                        3.1.0
community.zabbix                         4.1.1
containers.podman                        1.19.0
cyberark.conjur                          1.3.9
cyberark.pas                             1.0.39
dellemc.enterprise_sonic                 3.2.0
dellemc.openmanage                       10.0.1
dellemc.powerflex                        3.0.0
dellemc.unity                            2.1.0
f5networks.f5_modules                    1.39.0
fortinet.fortimanager                    2.13.0
fortinet.fortios                         2.5.0
google.cloud                             1.12.0
grafana.grafana                          6.0.6
graphiant.naas                           26.2.4
hetzner.hcloud                           6.8.0
hitachivantara.vspone_block              4.6.1
hitachivantara.vspone_object             1.1.1
ibm.storage_virtualize                   3.2.0
ieisystem.inmanage                       4.0.0
infinidat.infinibox                      1.6.3
infoblox.nios_modules                    1.9.0
inspur.ispim                             2.2.4
junipernetworks.junos                    11.0.0
kaytus.ksmanage                          2.0.0
kubernetes.core                          6.3.0
kubevirt.core                            2.2.4
lowlydba.sqlserver                       2.7.0
microsoft.ad                             1.10.0
microsoft.iis                            1.1.0
netapp.cloudmanager                      21.24.0
netapp.ontap                             23.4.0
netapp.storagegrid                       21.16.0
netapp_eseries.santricity                1.4.1
netbox.netbox                            3.22.0
ngine_io.cloudstack                      3.0.0
openstack.cloud                          2.5.0
ovirt.ovirt                              3.2.2
pcg.alpaca_operator                      2.2.0
purestorage.flasharray                   1.42.0
purestorage.flashblade                   1.24.0
ravendb.ravendb                          1.0.4
splunk.es                                4.0.0
telekom_mms.icinga_director              2.5.1
theforeman.foreman                       5.10.0
vmware.vmware                            2.8.0
vmware.vmware_rest                       4.10.0
vultr.cloud                              1.14.0
vyos.vyos                                6.0.0
wti.remote                               1.0.11

# /usr/share/ansible/collections/ansible_collections
Collection                               Version
---------------------------------------- -------
nutanix.ncp                              2.5.0

Logs & errors

From playbook output on downstream node the 'extra_vars' does not contain 'my_variable':

extra_vars: ('{"semaphore_vars":{"task_details":{"commit_hash":null,"commit_message":"","id":106,"inventory_id":1,"inventory_name":"NULL INVENTORY","repository_id":1,"repository_name":"Local GIT","url":null,"username":"admin"}}}',)

Manual installation - system information

No response

Configuration

Upstream play

  • name: Generate a variable to pass downstream
    hosts: local-runner
    gather_facts: false

    tasks:

    • name: Generate a variable
      ansible.builtin.set_fact:
      my_variable: "content_of_my_variable"

    • name: Set variable using 'set_stats'
      ansible.builtin.set_stats:
      data:
      deployment_id: "{{ my_variable }}"

Downstream play

  • name: Read upstream variable
    hosts: local-runner
    gather_facts: true

    tasks:

    • name: Display variable from upstream
      ansible.builtin.debug:
      var: my_variable

Additional information

I have a PRO trial subscription

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions