Skip to content

Commit 0fb9485

Browse files
committed
User and Group ID fixes
For GitHub actions, use 1001 for both the user and group IDs to (hopefully) address permission issues when generating test result artifacts upon failure.
1 parent 1d3d192 commit 0fb9485

File tree

6 files changed

+20
-7
lines changed

6 files changed

+20
-7
lines changed

packer/provisioners/ansible/group_vars/all.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
install_dir: /usr/thredds-test-environment
44
tmp_dir: /tmp/thredds-ansible-tmp
55

6-
# The variable thredds_test_user is defined in the packer configuration
7-
# located at packer/thredds-test-env.json.
8-
96
network_call_time_between_retries: 30 # seconds
107
network_call_retries: 3
118

packer/provisioners/ansible/roles/security/tasks/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
- include_tasks: ssh.yml
66
tags: [ ssh ]
77

8+
# The variable thredds_test_user is defined in the packer configuration
9+
# located at packer/thredds-test-env.pkr.hcl.
810
- name: Create .m2 directory for user
911
file:
1012
path: "/home/{{ thredds_test_user }}/.m2"

packer/provisioners/ansible/roles/security/vars/main.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
custom_bash_profile_src: thredds_test_bash_profile.sh
55
custom_bash_profile_dest: "/etc/profile.d/{{ custom_bash_profile_src }}"
66

7+
# The variables thredds_test_user, thredds_test_user_uid, and thredds_test_user_gid are
8+
# defined in the packer configuration located at packer/thredds-test-env.pkr.hcl.
79
users:
810
- name: "{{ thredds_test_user }}"
911
shell: /bin/bash
10-
uid: 395
11-
gid: 395
12+
uid: "{{ thredds_test_user_uid }}"
13+
gid: "{{ thredds_test_user_gid }}"
1214
group: "{{ thredds_test_user }}"
1315

1416
files2copy:

packer/provisioners/ansible/roles/thredds-test-data-mount-prep/tasks/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
---
2+
3+
# The variable thredds_test_user is defined in the packer configuration
4+
# located at packer/thredds-test-env.pkr.hcl.
25
- name: Ensure the '{{ cdmUnitTest_mount_dir }}' exists.
36
file:
47
path: "{{ cdmUnitTest_mount_dir }}"

packer/provisioners/ansible/site.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
- name: THREDDS Test Environment playbook.
33
hosts: all
4-
remote_user: "{{ thredds_test_user }}" # Defined in packer config
4+
remote_user: "{{ thredds_test_user }}" # Defined in packer config located at packer/thredds-test-env.pkr.hcl
55
become: yes
66
become_method: sudo
77
tasks:

packer/thredds-test-env.pkr.hcl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ packer {
1414
locals {
1515
base_docker_image = "ubuntu:24.04"
1616
thredds_test_user = "jenkins"
17+
gha_uid = "1001"
18+
gha_gid = "1001"
19+
jenkins_uid = "395"
20+
jenkins_gid = "395"
1721
}
1822

1923
source "docker" "docker-jenkins" {
@@ -62,7 +66,12 @@ build {
6266
provisioner "ansible-local" {
6367
clean_staging_directory = true
6468
command = "ANSIBLE_CONFIG=/ansible_config/ansible.cfg ANSIBLE_FORCE_COLOR=1 PYTHONUNBUFFERED=1 ansible-playbook"
65-
extra_arguments = ["--extra-vars", "\"thredds_test_user=${local.thredds_test_user}\""]
69+
extra_arguments = ["--extra-vars", "\"thredds_test_user=${local.thredds_test_user} thredds_test_user_uid=${local.jenkins_uid} thredds_test_user_gid=${local.jenkins_gid}\""]
70+
override = {
71+
docker-github-action = {
72+
extra_arguments = ["--extra-vars", "\"thredds_test_user=${local.thredds_test_user} thredds_test_user_uid=${local.gha_uid} thredds_test_user_gid=${local.gha_gid}\""]
73+
}
74+
}
6675
group_vars = "provisioners/ansible/group_vars"
6776
playbook_file = "provisioners/ansible/site.yml"
6877
role_paths = ["provisioners/ansible/roles/cleanup",

0 commit comments

Comments
 (0)