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

ansible: dynamically exclude jenkins-workspace #3816

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions ansible/playbooks/jenkins/worker/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@
- hosts:
- test
- release
- "!test-equinix-ubuntu2204-x64-1"
- "!test-equinix-ubuntu2204-x64-2"
- "!test-ibm-ubuntu2204-x64-3"
tasks:
- name: remove node and npm packages
when:
Expand All @@ -97,20 +94,25 @@
- not os|startswith("win")
- not os|startswith("zos")
- os != "macos11.0"
- not (alias is defined and alias is match('jenkins-workspace.*'))
package:
name: "{{ package }}"
state: absent
loop_control:
loop_var: package
with_items: [ "node", "nodejs", "npm" ]
- name: fail if node is in the path - please uninstall it
when: not os|startswith("win")
when:
- not os|startswith("win")
- not (alias is defined and alias is match('jenkins-workspace.*'))
shell: "node -v"
register: node_check_cmd
failed_when: node_check_cmd.rc == 0
changed_when: False
- name: fail if node is in the path - please uninstall it
when: os|startswith("win")
when:
- os|startswith("win")
- not (alias is defined and alias is match('jenkins-workspace.*'))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically this one isn't needed -- we have no "win*" hosts that are also jenkins-workspace but I've added it for consistency with all the other tasks.

win_shell: "node -v"
register: node_check_cmd_win
failed_when: node_check_cmd_win.rc == 0
Expand Down