]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
tests: add CI user creation to simulate cloud VM environments
authorIker Pedrosa <ipedrosa@redhat.com>
Tue, 14 Apr 2026 11:19:10 +0000 (13:19 +0200)
committerSerge Hallyn <serge@hallyn.com>
Tue, 28 Apr 2026 13:17:39 +0000 (08:17 -0500)
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 <ipedrosa@redhat.com>
share/ansible/roles/ci_run/tasks/alpine.yml
share/ansible/roles/ci_run/tasks/debian.yml
share/ansible/roles/ci_run/tasks/fedora.yml
share/ansible/roles/ci_run/tasks/opensuse.yml

index 85c3a56d77c0f8179120065606f946d2611394a9..5115fe6886419f5ebbd77f800408a699d233fe45 100644 (file)
     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
index 97324506a0eb987278f587d51a8af0a911b6138c..786e0f6b53493cf663cafd696b14b6b3552ea624 100644 (file)
     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
index 2fc6781e276624f2fc826f8591e6948490a0e2c6..dd6bd6477f560bcc58f04d343b834a45802c01fe 100644 (file)
     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
index 51240c7d4ccc0375d1c749f1001e5387dcba569d..28842ec1103e5b4097c08f9060f6ee0c20499db4 100644 (file)
     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