From: Iker Pedrosa Date: Tue, 14 Apr 2026 11:19:10 +0000 (+0200) Subject: tests: add CI user creation to simulate cloud VM environments X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bfdaa0c60a06c987b7a11a4fc20d152796c130ee;p=thirdparty%2Fshadow.git tests: add CI user creation to simulate cloud VM environments Create a 'ci' user in all distribution-specific ansible roles to simulate cloud VM environments where ID 1000 is already taken. This ensures that test users start the ID assignment at 1001, making container tests consistent with cloud CI environments. Signed-off-by: Iker Pedrosa --- diff --git a/share/ansible/roles/ci_run/tasks/alpine.yml b/share/ansible/roles/ci_run/tasks/alpine.yml index 85c3a56d7..5115fe688 100644 --- a/share/ansible/roles/ci_run/tasks/alpine.yml +++ b/share/ansible/roles/ci_run/tasks/alpine.yml @@ -34,6 +34,20 @@ dest: /bin/expect state: link +- name: Check if UID 1000 already exists + ansible.builtin.getent: + database: passwd + key: 1000 + register: existing_uid_1000 + failed_when: false + +- name: Create CI user to simulate cloud VM environment + ansible.builtin.user: + name: ci + create_home: true + shell: /bin/bash + when: existing_uid_1000.ansible_facts.getent_passwd['1000'] is undefined + - name: Build configuration ansible.builtin.command: > ./autogen.sh diff --git a/share/ansible/roles/ci_run/tasks/debian.yml b/share/ansible/roles/ci_run/tasks/debian.yml index 97324506a..786e0f6b5 100644 --- a/share/ansible/roles/ci_run/tasks/debian.yml +++ b/share/ansible/roles/ci_run/tasks/debian.yml @@ -34,6 +34,20 @@ pkg: shadow state: build-dep +- name: Check if UID 1000 already exists + ansible.builtin.getent: + database: passwd + key: 1000 + register: existing_uid_1000 + failed_when: false + +- name: Create CI user to simulate cloud VM environment + ansible.builtin.user: + name: ci + create_home: true + shell: /bin/bash + when: existing_uid_1000.ansible_facts.getent_passwd['1000'] is undefined + - name: Build configuration ansible.builtin.command: > ./autogen.sh diff --git a/share/ansible/roles/ci_run/tasks/fedora.yml b/share/ansible/roles/ci_run/tasks/fedora.yml index 2fc6781e2..dd6bd6477 100644 --- a/share/ansible/roles/ci_run/tasks/fedora.yml +++ b/share/ansible/roles/ci_run/tasks/fedora.yml @@ -40,6 +40,20 @@ group: root mode: '0644' +- name: Check if UID 1000 already exists + ansible.builtin.getent: + database: passwd + key: 1000 + register: existing_uid_1000 + failed_when: false + +- name: Create CI user to simulate cloud VM environment + ansible.builtin.user: + name: ci + create_home: true + shell: /bin/bash + when: existing_uid_1000.ansible_facts.getent_passwd['1000'] is undefined + - name: Build configuration ansible.builtin.command: > ./autogen.sh diff --git a/share/ansible/roles/ci_run/tasks/opensuse.yml b/share/ansible/roles/ci_run/tasks/opensuse.yml index 51240c7d4..28842ec11 100644 --- a/share/ansible/roles/ci_run/tasks/opensuse.yml +++ b/share/ansible/roles/ci_run/tasks/opensuse.yml @@ -42,6 +42,20 @@ group: root mode: '0000' +- name: Check if UID 1000 already exists + ansible.builtin.getent: + database: passwd + key: 1000 + register: existing_uid_1000 + failed_when: false + +- name: Create CI user to simulate cloud VM environment + ansible.builtin.user: + name: ci + create_home: true + shell: /bin/bash + when: existing_uid_1000.ansible_facts.getent_passwd['1000'] is undefined + - name: Build configuration ansible.builtin.command: > ./autogen.sh