From 1c4beed4a5bc5c1daced20cb6f76671964c20131 Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Tue, 13 Feb 2024 11:32:15 +0000 Subject: [PATCH 01/26] automate deployment of dockernode --- .../AdoptOpenJDK_Unix_Playbook/dockernode.yml | 13 ++++++++ .../roles/deploy_container/tasks/deploy.yml | 26 ++++++++++++++++ .../roles/deploy_container/tasks/main.yml | 31 +++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml create mode 100644 ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml create mode 100644 ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml new file mode 100644 index 0000000000..8988083e71 --- /dev/null +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml @@ -0,0 +1,13 @@ +--- +############################### +# Adoptium - Ansible Playbook # +############################### + +- name: dockernode playbook + hosts: localhost + gather_facts: yes + + roles: + - Debug + - role: deploy_container + tags: deploy diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml new file mode 100644 index 0000000000..f64388b80f --- /dev/null +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml @@ -0,0 +1,26 @@ +--- + +# - name: debug from deploy - task 1 +# debug: +# msg: "{{ docker_image }}" + +# - name: task 2 +# debug: +# msg: " Hello " + +# - name: task 3 +# debug: +# msg: "{{ arch }} + {{ os }}" + + +- name: Find free port + +- name: Transfer dockerfile + +- name: build docker images + command: docker build --cpu-period=100000 --cpu-quota=800000 -t aqa_{{ item }} --memory=6G -f /tmp/Dockerfiles/Dockerfile.Dockerfile{{ docker_image }} /tmp/Dockerfiles + +- name: run container + command: docker run --restart unless-stopped -p {{ port }}:22 --cpuset-cpus="0-3" --memory=6G --detach --name {{ docker_image }}.{{ port }} aqa_{{ docker_image }} + +# - name: run python file which creates jenkins node \ No newline at end of file diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml new file mode 100644 index 0000000000..6b6c3f41bf --- /dev/null +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml @@ -0,0 +1,31 @@ +--- + +# This is a wrapper, this role with run a sub role (one which actually builds and runs the container) +# It will loop the sub role depending on the number of containers the user wants to build + +# Does there exist a dockerfile of the chosen OS? +- name: Verify passed variables + debug: + msg: "{{ docker_images }}" + +# List of docker images to create +- name: set docker images list + set_fact: + docker_images_list: "{{ docker_images.split(',') | list }}" + +# - name: print docker_images_list +# debug: +# msg: "{{ item }}" +# loop: "{{ docker_images_list }}" + +- name: Set variables (architecture etc) to be put into dockerfile + + # set_fact: + # arch: armv7 + # os: ubuntu + +- name: run deploy.yml with variables + include_tasks: deploy.yml + loop: "{{ docker_images_list }}" + loop_control: + loop_var: docker_image From 95fe22878973baf499b5a778cb6dc4a998079654 Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Tue, 13 Feb 2024 13:40:35 +0000 Subject: [PATCH 02/26] check if dockerfiles exist --- .../AdoptOpenJDK_Unix_Playbook/dockernode.yml | 5 +- .../roles/deploy_container/tasks/deploy.yml | 52 +++++++++++-------- .../roles/deploy_container/tasks/main.yml | 32 +++++------- 3 files changed, 46 insertions(+), 43 deletions(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml index 8988083e71..d10b3f70cd 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml @@ -4,10 +4,11 @@ ############################### - name: dockernode playbook - hosts: localhost + hosts: all gather_facts: yes roles: - - Debug + - role: Debug + tags: debug - role: deploy_container tags: deploy diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml index f64388b80f..73674461b4 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml @@ -1,26 +1,36 @@ --- -# - name: debug from deploy - task 1 -# debug: -# msg: "{{ docker_image }}" - -# - name: task 2 -# debug: -# msg: " Hello " - -# - name: task 3 -# debug: -# msg: "{{ arch }} + {{ os }}" - - -- name: Find free port - - name: Transfer dockerfile - -- name: build docker images - command: docker build --cpu-period=100000 --cpu-quota=800000 -t aqa_{{ item }} --memory=6G -f /tmp/Dockerfiles/Dockerfile.Dockerfile{{ docker_image }} /tmp/Dockerfiles - -- name: run container - command: docker run --restart unless-stopped -p {{ port }}:22 --cpuset-cpus="0-3" --memory=6G --detach --name {{ docker_image }}.{{ port }} aqa_{{ docker_image }} + copy: + src: Dockerfiles/ + dest: /tmp/Dockerfiles/Dockerfile.{{ docker_image }} + +- name: Translate architecture in dockerfiles + replace: + dest: /tmp/Dockerfiles/Dockerfile.{{ docker_image }} + regexp: "arch=x64" + replace: "arch={{ ansible_architecture }}" + when: ansible_architecture != "x86_64" + +- name: Set jenkins authorized_Key in dockerfiles + replace: + dest: /tmp/Dockerfiles/Dockerfile.{{ docker_image }} + regexp: "Jenkins_User_SSHKey" + replace: "{{ Jenkins_User_SSHKey }}" + +- name: Build {{ docker_image }} docker images + command: docker build --cpu-period=100000 --cpu-quota=800000 -t aqa_{{ item }} --memory=6G -f /tmp/Dockerfiles/Dockerfile.{{ docker_image }} /tmp/Dockerfiles + +# Without specifying a port here, docker will give the container a random unused port +- name: Run {{ docker_image }} docker container + command: docker run --restart unless-stopped -p 22 --cpuset-cpus="0-3" --memory=6G --detach --name {{ docker_image | upper }}.PORT aqa_{{ docker_image }} + +# Now we want to rename the running container with the port name +- name: Find assigned port of {{ docker_image }} container + command: docker port {{ docker_image | upper }}.PORT | head -n 1 | cut -d ':' -f 2 + register: docker_port + +- name: Rename {{ docker_image }} container to {{ docker_image | upper }}.{{ docker_port.stdout_lines[0] }} + command: docker rename {{ docker_image | upper }}.PORT {{ docker_image | upper }}.{{ docker_port.stdout_lines[0] }} # - name: run python file which creates jenkins node \ No newline at end of file diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml index 6b6c3f41bf..c43951ac82 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml @@ -1,30 +1,22 @@ --- -# This is a wrapper, this role with run a sub role (one which actually builds and runs the container) -# It will loop the sub role depending on the number of containers the user wants to build - -# Does there exist a dockerfile of the chosen OS? -- name: Verify passed variables - debug: - msg: "{{ docker_images }}" - -# List of docker images to create -- name: set docker images list +- name: Set docker images list variable set_fact: docker_images_list: "{{ docker_images.split(',') | list }}" -# - name: print docker_images_list -# debug: -# msg: "{{ item }}" -# loop: "{{ docker_images_list }}" +- name: Check if dockerfiles exist + stat: + path: "DockerStatic/Dockerfiles/Dockerfile.{{ item }}" + loop: "{{ docker_images_list }}" + register: dockerfiles_exist -- name: Set variables (architecture etc) to be put into dockerfile - - # set_fact: - # arch: armv7 - # os: ubuntu +- name: Fail if dockerfile does not exist + fail: + msg: "{{ item.stat.path }} does not exist" + when: not item.stat.exists + loop: "{{ dockerfiles_exist.results }}" -- name: run deploy.yml with variables +- name: Run deploy.yml for every docker image include_tasks: deploy.yml loop: "{{ docker_images_list }}" loop_control: From f4d83fdc5da5886c9ad446b68cde4a8b6aa93f32 Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Tue, 13 Feb 2024 13:41:28 +0000 Subject: [PATCH 03/26] correct copy address --- .../roles/deploy_container/tasks/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml index 73674461b4..15df1379be 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml @@ -2,7 +2,7 @@ - name: Transfer dockerfile copy: - src: Dockerfiles/ + src: DockerStatic/Dockerfiles/ dest: /tmp/Dockerfiles/Dockerfile.{{ docker_image }} - name: Translate architecture in dockerfiles From 3ee645cb20d9f432de992f62ec264927d5449613 Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Tue, 13 Feb 2024 13:43:01 +0000 Subject: [PATCH 04/26] correct src address --- .../roles/deploy_container/tasks/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml index 15df1379be..ef5ed1d852 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml @@ -2,7 +2,7 @@ - name: Transfer dockerfile copy: - src: DockerStatic/Dockerfiles/ + src: DockerStatic/Dockerfiles/Dockerfile.{{ docker_image }} dest: /tmp/Dockerfiles/Dockerfile.{{ docker_image }} - name: Translate architecture in dockerfiles From cf6f3dd3bba11d639ff3bcaf9b78555f6a1c5bda Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Tue, 13 Feb 2024 13:44:29 +0000 Subject: [PATCH 05/26] correct variable used --- .../roles/deploy_container/tasks/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml index ef5ed1d852..0a1b5ebe12 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml @@ -19,7 +19,7 @@ replace: "{{ Jenkins_User_SSHKey }}" - name: Build {{ docker_image }} docker images - command: docker build --cpu-period=100000 --cpu-quota=800000 -t aqa_{{ item }} --memory=6G -f /tmp/Dockerfiles/Dockerfile.{{ docker_image }} /tmp/Dockerfiles + command: docker build --cpu-period=100000 --cpu-quota=800000 -t aqa_{{ docker_image }} --memory=6G -f /tmp/Dockerfiles/Dockerfile.{{ docker_image }} /tmp/Dockerfiles # Without specifying a port here, docker will give the container a random unused port - name: Run {{ docker_image }} docker container From 1a745e666c85d516c475373a8bec7cdb53ad7bb8 Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Tue, 13 Feb 2024 13:45:21 +0000 Subject: [PATCH 06/26] typo --- .../roles/deploy_container/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml index c43951ac82..f64043106d 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml @@ -4,7 +4,7 @@ set_fact: docker_images_list: "{{ docker_images.split(',') | list }}" -- name: Check if dockerfiles exist +- name: Check if dockerfile exists stat: path: "DockerStatic/Dockerfiles/Dockerfile.{{ item }}" loop: "{{ docker_images_list }}" From e9dfc93959585e33eb22d22a2f93d60d429d532f Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Tue, 13 Feb 2024 13:46:06 +0000 Subject: [PATCH 07/26] linter --- .../roles/deploy_container/tasks/deploy.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml index 0a1b5ebe12..21ad612a8c 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml @@ -32,5 +32,3 @@ - name: Rename {{ docker_image }} container to {{ docker_image | upper }}.{{ docker_port.stdout_lines[0] }} command: docker rename {{ docker_image | upper }}.PORT {{ docker_image | upper }}.{{ docker_port.stdout_lines[0] }} - -# - name: run python file which creates jenkins node \ No newline at end of file From 9c9ab8c2cb8adb4db1381d704b667a045f0eec78 Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Tue, 13 Feb 2024 13:56:13 +0000 Subject: [PATCH 08/26] linter --- ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml | 2 +- .../roles/deploy_container/tasks/deploy.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml index d10b3f70cd..5cd58a5b2b 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml @@ -6,7 +6,7 @@ - name: dockernode playbook hosts: all gather_facts: yes - + roles: - role: Debug tags: debug diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml index 21ad612a8c..f8f379ba3f 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml @@ -14,7 +14,7 @@ - name: Set jenkins authorized_Key in dockerfiles replace: - dest: /tmp/Dockerfiles/Dockerfile.{{ docker_image }} + dest: /tmp/Dockerfiles/Dockerfile.{{ docker_image }} regexp: "Jenkins_User_SSHKey" replace: "{{ Jenkins_User_SSHKey }}" From 10c1e9f98493dde0577e4fe3571f63e94186c3b8 Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Tue, 13 Feb 2024 13:59:54 +0000 Subject: [PATCH 09/26] upper case name --- ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml index 5cd58a5b2b..3208903833 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml @@ -3,7 +3,7 @@ # Adoptium - Ansible Playbook # ############################### -- name: dockernode playbook +- name: Dockernode playbook hosts: all gather_facts: yes From 87004b3dc6ecea469a049f93328df7932ba586aa Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Wed, 14 Feb 2024 11:44:31 +0000 Subject: [PATCH 10/26] test dockerfile verification --- .../roles/deploy_container/tasks/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml index f64043106d..15fc620264 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml @@ -16,8 +16,8 @@ when: not item.stat.exists loop: "{{ dockerfiles_exist.results }}" -- name: Run deploy.yml for every docker image - include_tasks: deploy.yml - loop: "{{ docker_images_list }}" - loop_control: - loop_var: docker_image +# - name: Run deploy.yml for every docker image +# include_tasks: deploy.yml +# loop: "{{ docker_images_list }}" +# loop_control: +# loop_var: docker_image From ed1aec0904831f259583abcf60a2a5bbcfc1efc0 Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Wed, 14 Feb 2024 11:45:31 +0000 Subject: [PATCH 11/26] debug --- .../roles/deploy_container/tasks/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml index 15fc620264..4a731f78da 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml @@ -10,6 +10,10 @@ loop: "{{ docker_images_list }}" register: dockerfiles_exist +- name: Debug, print dockerfiles_exist + msg: + debug: "{{ dockerfiles_exist }}" + - name: Fail if dockerfile does not exist fail: msg: "{{ item.stat.path }} does not exist" From 21ec700e337d27d713675987a0530f57a65a9088 Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Wed, 14 Feb 2024 11:47:21 +0000 Subject: [PATCH 12/26] debug typo --- .../roles/deploy_container/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml index 4a731f78da..f70c638ea1 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml @@ -11,8 +11,8 @@ register: dockerfiles_exist - name: Debug, print dockerfiles_exist - msg: - debug: "{{ dockerfiles_exist }}" + debug: + msg: "{{ dockerfiles_exist }}" - name: Fail if dockerfile does not exist fail: From 57cd58c8898a2aaedcf888846ebee7aec59cd577 Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Wed, 14 Feb 2024 11:51:24 +0000 Subject: [PATCH 13/26] change path and correct variable --- .../roles/deploy_container/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml index f70c638ea1..92f83e4ffd 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml @@ -6,7 +6,7 @@ - name: Check if dockerfile exists stat: - path: "DockerStatic/Dockerfiles/Dockerfile.{{ item }}" + path: "../../DockerStatic/Dockerfiles/Dockerfile.{{ item }}" loop: "{{ docker_images_list }}" register: dockerfiles_exist @@ -16,7 +16,7 @@ - name: Fail if dockerfile does not exist fail: - msg: "{{ item.stat.path }} does not exist" + msg: "{{ item.invocation.module_args.path }} does not exist" when: not item.stat.exists loop: "{{ dockerfiles_exist.results }}" From 470225f4d1fffc7608ac22f52182f7b60c387ed4 Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Wed, 14 Feb 2024 11:56:41 +0000 Subject: [PATCH 14/26] delegate stat to localhost --- .../roles/deploy_container/tasks/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml index 92f83e4ffd..6ab3f5ba85 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml @@ -5,8 +5,9 @@ docker_images_list: "{{ docker_images.split(',') | list }}" - name: Check if dockerfile exists + delegate_to: localhost stat: - path: "../../DockerStatic/Dockerfiles/Dockerfile.{{ item }}" + path: "DockerStatic/Dockerfiles/Dockerfile.{{ item }}" loop: "{{ docker_images_list }}" register: dockerfiles_exist From e0ca08f04a1a3f04bf675e3c508f45ad4d9ce276 Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Wed, 14 Feb 2024 11:57:25 +0000 Subject: [PATCH 15/26] change path --- .../roles/deploy_container/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml index 6ab3f5ba85..54b3cb5ea5 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml @@ -7,7 +7,7 @@ - name: Check if dockerfile exists delegate_to: localhost stat: - path: "DockerStatic/Dockerfiles/Dockerfile.{{ item }}" + path: "../../DockerStatic/Dockerfiles/Dockerfile.{{ item }}" loop: "{{ docker_images_list }}" register: dockerfiles_exist From 43f62d9b2563c90f180164c6941b4a4783827b07 Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Wed, 14 Feb 2024 12:00:48 +0000 Subject: [PATCH 16/26] change path --- .../roles/deploy_container/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml index 54b3cb5ea5..43ef942dbf 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml @@ -7,7 +7,7 @@ - name: Check if dockerfile exists delegate_to: localhost stat: - path: "../../DockerStatic/Dockerfiles/Dockerfile.{{ item }}" + path: "../DockerStatic/Dockerfiles/Dockerfile.{{ item }}" loop: "{{ docker_images_list }}" register: dockerfiles_exist From c4cb688dff1b969444ee54fb061e5b9aed86d2d5 Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Wed, 14 Feb 2024 12:02:42 +0000 Subject: [PATCH 17/26] debug: find current location --- .../roles/deploy_container/tasks/main.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml index 43ef942dbf..2ef21ae3e8 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml @@ -4,6 +4,15 @@ set_fact: docker_images_list: "{{ docker_images.split(',') | list }}" +- name: PWD + delegate_to: localhost + command: pwd + register: PWD + +- name: Print PWD output + debug: + msg: "{{ PWD.stdout }}" + - name: Check if dockerfile exists delegate_to: localhost stat: From 40e4288d63588c7a13d69a03828a6dc0c74af3a3 Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Wed, 14 Feb 2024 12:03:32 +0000 Subject: [PATCH 18/26] change path --- .../roles/deploy_container/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml index 2ef21ae3e8..f707c84866 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml @@ -16,7 +16,7 @@ - name: Check if dockerfile exists delegate_to: localhost stat: - path: "../DockerStatic/Dockerfiles/Dockerfile.{{ item }}" + path: "roles/DockerStatic/Dockerfiles/Dockerfile.{{ item }}" loop: "{{ docker_images_list }}" register: dockerfiles_exist From 72907d3068f05576e27bae7cadd249c30540f3cf Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Wed, 14 Feb 2024 12:04:53 +0000 Subject: [PATCH 19/26] remove debug pwd, change path --- .../roles/deploy_container/tasks/deploy.yml | 4 ++-- .../roles/deploy_container/tasks/main.yml | 9 --------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml index f8f379ba3f..ead16d6ecb 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml @@ -2,8 +2,8 @@ - name: Transfer dockerfile copy: - src: DockerStatic/Dockerfiles/Dockerfile.{{ docker_image }} - dest: /tmp/Dockerfiles/Dockerfile.{{ docker_image }} + src: "roles/DockerStatic/Dockerfiles/Dockerfile.{{ docker_image }}" + dest: "/tmp/Dockerfiles/Dockerfile.{{ docker_image }}" - name: Translate architecture in dockerfiles replace: diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml index f707c84866..ce8cc024b9 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml @@ -4,15 +4,6 @@ set_fact: docker_images_list: "{{ docker_images.split(',') | list }}" -- name: PWD - delegate_to: localhost - command: pwd - register: PWD - -- name: Print PWD output - debug: - msg: "{{ PWD.stdout }}" - - name: Check if dockerfile exists delegate_to: localhost stat: From 43b31102d175deb573205481de12bb16cce4b985 Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Wed, 14 Feb 2024 12:09:32 +0000 Subject: [PATCH 20/26] remove debug --- .../roles/deploy_container/tasks/deploy.yml | 2 +- .../roles/deploy_container/tasks/main.yml | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml index ead16d6ecb..fbd0be3ae4 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml @@ -5,7 +5,7 @@ src: "roles/DockerStatic/Dockerfiles/Dockerfile.{{ docker_image }}" dest: "/tmp/Dockerfiles/Dockerfile.{{ docker_image }}" -- name: Translate architecture in dockerfiles +- name: Translate architecture in dockerfile replace: dest: /tmp/Dockerfiles/Dockerfile.{{ docker_image }} regexp: "arch=x64" diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml index ce8cc024b9..35d4f36fcf 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml @@ -11,10 +11,6 @@ loop: "{{ docker_images_list }}" register: dockerfiles_exist -- name: Debug, print dockerfiles_exist - debug: - msg: "{{ dockerfiles_exist }}" - - name: Fail if dockerfile does not exist fail: msg: "{{ item.invocation.module_args.path }} does not exist" From 208fcd586f5ccb841fd623d5cb110f8cda357433 Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Wed, 14 Feb 2024 12:11:07 +0000 Subject: [PATCH 21/26] reinclude include task --- .../roles/deploy_container/tasks/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml index 35d4f36fcf..33f88d085e 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml @@ -17,8 +17,8 @@ when: not item.stat.exists loop: "{{ dockerfiles_exist.results }}" -# - name: Run deploy.yml for every docker image -# include_tasks: deploy.yml -# loop: "{{ docker_images_list }}" -# loop_control: -# loop_var: docker_image +- name: Run deploy.yml for every docker image + include_tasks: deploy.yml + loop: "{{ docker_images_list }}" + loop_control: + loop_var: docker_image From ceee19f172ca3b60e18008dfef29dd2aec21cbd1 Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Wed, 14 Feb 2024 12:17:34 +0000 Subject: [PATCH 22/26] change path of destination --- .../roles/deploy_container/tasks/deploy.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml index fbd0be3ae4..897518ae5d 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml @@ -3,23 +3,23 @@ - name: Transfer dockerfile copy: src: "roles/DockerStatic/Dockerfiles/Dockerfile.{{ docker_image }}" - dest: "/tmp/Dockerfiles/Dockerfile.{{ docker_image }}" + dest: "/tmp/Dockerfile.{{ docker_image }}" - name: Translate architecture in dockerfile replace: - dest: /tmp/Dockerfiles/Dockerfile.{{ docker_image }} + dest: /tmp/Dockerfile.{{ docker_image }} regexp: "arch=x64" replace: "arch={{ ansible_architecture }}" when: ansible_architecture != "x86_64" - name: Set jenkins authorized_Key in dockerfiles replace: - dest: /tmp/Dockerfiles/Dockerfile.{{ docker_image }} + dest: /tmp/Dockerfile.{{ docker_image }} regexp: "Jenkins_User_SSHKey" replace: "{{ Jenkins_User_SSHKey }}" - name: Build {{ docker_image }} docker images - command: docker build --cpu-period=100000 --cpu-quota=800000 -t aqa_{{ docker_image }} --memory=6G -f /tmp/Dockerfiles/Dockerfile.{{ docker_image }} /tmp/Dockerfiles + command: docker build --cpu-period=100000 --cpu-quota=800000 -t aqa_{{ docker_image }} --memory=6G -f /tmp/Dockerfile.{{ docker_image }} /tmp/ # Without specifying a port here, docker will give the container a random unused port - name: Run {{ docker_image }} docker container From 39ec2e044b37affae9b4e67b3a5fa63bd4e38e6f Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Wed, 14 Feb 2024 12:19:16 +0000 Subject: [PATCH 23/26] Add vendor_files role to retrieve jenkins public key --- ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml index 3208903833..160ca89a3b 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml @@ -10,5 +10,7 @@ roles: - role: Debug tags: debug + - role: Get_Vendor_Files + tags: deploy - role: deploy_container tags: deploy From 6e780611de1ef77d55df8d0b3cb76f10d8079005 Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Wed, 14 Feb 2024 12:24:50 +0000 Subject: [PATCH 24/26] update regex and change command to shell --- .../roles/deploy_container/tasks/deploy.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml index 897518ae5d..07f2e726ff 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml @@ -8,8 +8,8 @@ - name: Translate architecture in dockerfile replace: dest: /tmp/Dockerfile.{{ docker_image }} - regexp: "arch=x64" - replace: "arch={{ ansible_architecture }}" + regexp: "x64" + replace: "{{ ansible_architecture }}" when: ansible_architecture != "x86_64" - name: Set jenkins authorized_Key in dockerfiles @@ -27,7 +27,7 @@ # Now we want to rename the running container with the port name - name: Find assigned port of {{ docker_image }} container - command: docker port {{ docker_image | upper }}.PORT | head -n 1 | cut -d ':' -f 2 + shell: docker port {{ docker_image | upper }}.PORT | head -n 1 | cut -d ':' -f 2 register: docker_port - name: Rename {{ docker_image }} container to {{ docker_image | upper }}.{{ docker_port.stdout_lines[0] }} From 916733632a6aaf0be51e6bce70f6a4c8448e6366 Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Wed, 14 Feb 2024 15:48:41 +0000 Subject: [PATCH 25/26] update dockerfiles, ubuntu2310, alpine 319, fedora39, deb12 --- .../{Dockerfile.alp311 => Dockerfile.alp319} | 16 +++---- .../{Dockerfile.deb11 => Dockerfile.deb12} | 2 +- .../{Dockerfile.f35 => Dockerfile.f39} | 4 +- .../DockerStatic/Dockerfiles/Dockerfile.u2310 | 44 +++++++++++++++++++ 4 files changed, 55 insertions(+), 11 deletions(-) rename ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/{Dockerfile.alp311 => Dockerfile.alp319} (83%) rename ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/{Dockerfile.deb11 => Dockerfile.deb12} (99%) rename ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/{Dockerfile.f35 => Dockerfile.f39} (98%) create mode 100644 ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.u2310 diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.alp311 b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.alp319 similarity index 83% rename from ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.alp311 rename to ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.alp319 index 51f9008bbd..20b948719e 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.alp311 +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.alp319 @@ -1,4 +1,4 @@ -FROM alpine:3.11 +FROM alpine:3.19 RUN apk --update add bash shadow openssh-server openssh-client unzip zip wget git curl make gcc perl xvfb \ libxrender libxi libxtst procps musl-dev perl-doc alsa-lib libx11 msttcorefonts-installer fontconfig libxext freetype zlib fakeroot gnupg @@ -11,13 +11,13 @@ RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -P "" ## Ensure Fonts Are Updated (Issue https://github.com/adoptium/infrastructure/issues/3039) RUN update-ms-fonts -# Get latest jdk17 ga -RUN wget -q 'https://api.adoptium.net/v3/binary/latest/17/ga/alpine-linux/x64/jdk/hotspot/normal/eclipse?project=jdk' -O /tmp/jdk17.tar.gz +# Get latest jdk21 ga +RUN wget -q 'https://api.adoptium.net/v3/binary/latest/21/ga/alpine-linux/x64/jdk/hotspot/normal/eclipse?project=jdk' -O /tmp/jdk21.tar.gz RUN gpg --keyserver keyserver.ubuntu.com --recv-keys 3B04D753C9050D9A5D343F39843C48A565F8F04B -# Get sig file for latest jdk17 ga -RUN wget -q `curl -s 'https://api.adoptium.net/v3/assets/feature_releases/17/ga?architecture=x64&heap_size=normal&image_type=jdk&jvm_impl=hotspot&os=alpine-linux&page=0&page_size=1&project=jdk&vendor=eclipse' | grep signature_link | awk '{split($0,a,"\""); print a[4]}'` -O /tmp/jdk17.sig -RUN gpg --verify /tmp/jdk17.sig /tmp/jdk17.tar.gz -RUN mkdir -p /usr/lib/jvm/jdk17 && tar -xpzf /tmp/jdk17.tar.gz -C /usr/lib/jvm/jdk17 --strip-components=1 +# Get sig file for latest jdk21 ga +RUN wget -q `curl -s 'https://api.adoptium.net/v3/assets/feature_releases/21/ga?architecture=x64&heap_size=normal&image_type=jdk&jvm_impl=hotspot&os=alpine-linux&page=0&page_size=1&project=jdk&vendor=eclipse' | grep signature_link | awk '{split($0,a,"\""); print a[4]}'` -O /tmp/jdk21.sig +RUN gpg --verify /tmp/jdk21.sig /tmp/jdk21.tar.gz +RUN mkdir -p /usr/lib/jvm/jdk21 && tar -xpzf /tmp/jdk21.tar.gz -C /usr/lib/jvm/jdk21 --strip-components=1 # Install ant and ant-contrib. RUN wget -O /tmp/ant.zip 'https://archive.apache.org/dist/ant/binaries/apache-ant-1.10.9-bin.zip' @@ -39,7 +39,7 @@ RUN chown -R jenkins:jenkins /home/jenkins/.ssh RUN chmod -R "g=,o=" /home/jenkins/.ssh # Remove temporary files. -RUN rm -rf /tmp/jdk17.tar.gz /tmp/ant* /tmp/ant-contrib* /tmp/jdk17.sig +RUN rm -rf /tmp/jdk21.tar.gz /tmp/ant* /tmp/ant-contrib* /tmp/jdk21.sig # Start container with docker run -p 2222:22 UUID. CMD ["/usr/sbin/sshd","-D"] diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.deb11 b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.deb12 similarity index 99% rename from ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.deb11 rename to ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.deb12 index 922eec895c..3bfcf0e4b9 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.deb11 +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.deb12 @@ -1,4 +1,4 @@ -FROM debian:bullseye +FROM debian:12 # Install Base Requirements RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections RUN apt-get update && apt-get install -y perl openssh-server unzip zip wget apt-utils gnupg curl diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.f35 b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.f39 similarity index 98% rename from ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.f35 rename to ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.f39 index 8469966a27..aa8d11ce99 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.f35 +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.f39 @@ -1,4 +1,4 @@ -FROM fedora:35 +FROM fedora:39 RUN yum -y update && yum install -y perl openssh-server unzip zip wget RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -P "" @@ -30,7 +30,7 @@ CMD ["/usr/sbin/sshd","-D"] RUN yum install -y git curl make gcc xorg-x11-server-Xvfb libXrender libXi libXtst procps glibc-langpack-en fontconfig which hostname fakeroot shared-mime-info # Install Packages For openssl -RUN yum -y update && yum install -y openssl gnutls gnutls-utils libnss3.so nss-devel nss-tools +RUN yum -y update && yum install -y openssl gnutls gnutls-utils nss-devel nss-tools # ENTRYPOINT /usr/lib/jvm/jdk17/bin/java EXPOSE 22 # Start with docker run -p 2222:22 UUID diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.u2310 b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.u2310 new file mode 100644 index 0000000000..eda661de9a --- /dev/null +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/Dockerfiles/Dockerfile.u2310 @@ -0,0 +1,44 @@ +FROM ubuntu:23.10 + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get install -qq -y perl openssh-server unzip zip gnupg curl + +# Get latest jdk17 ga +RUN wget -q 'https://api.adoptium.net/v3/binary/latest/17/ga/linux/x64/jdk/hotspot/normal/eclipse?project=jdk' -O /tmp/jdk17.tar.gz +RUN gpg --keyserver keyserver.ubuntu.com --recv-keys 3B04D753C9050D9A5D343F39843C48A565F8F04B +# Get sig file for latest jdk17 ga +RUN wget -q `curl -s 'https://api.adoptium.net/v3/assets/feature_releases/17/ga?architecture=x64&heap_size=normal&image_type=jdk&jvm_impl=hotspot&os=linux&page=0&page_size=1&project=jdk&vendor=eclipse' | grep signature_link | awk '{split($0,a,"\""); print a[4]}'` -O /tmp/jdk17.sig +RUN gpg --verify /tmp/jdk17.sig /tmp/jdk17.tar.gz +RUN mkdir -p /usr/lib/jvm/jdk17 && tar -xpzf /tmp/jdk17.tar.gz -C /usr/lib/jvm/jdk17 --strip-components=1 + +# Install ant +RUN wget -q -O /tmp/ant.zip 'https://archive.apache.org/dist/ant/binaries/apache-ant-1.10.5-bin.zip' +RUN wget -q -O /tmp/ant-contrib.tgz https://sourceforge.net/projects/ant-contrib/files/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.tar.gz +RUN echo "2e48f9e429d67708f5690bc307232f08440d01ebe414059292b6543971da9c7cd259c21533b9163b4dd753321c17bd917adf8407d03245a0945fc30a4e633163 /tmp/ant.zip" > /tmp/ant.sha512 +RUN echo "0fd2771dca2b8b014a4cb3246715b32e20ad5d26754186d82eee781507a183d5e63064890b95eb27c091c93c1209528a0b18a6d7e6901899319492a7610e74ad /tmp/ant-contrib.tgz" >> /tmp/ant.sha512 +RUN sha512sum --check --strict /tmp/ant.sha512 +RUN ln -s /usr/local/apache-ant-1.10.5/bin/ant /usr/bin/ant +RUN unzip -q -d /usr/local /tmp/ant.zip +RUN tar xpfz /tmp/ant-contrib.tgz -C /usr/local/apache-ant-1.10.5/lib --strip-components=2 ant-contrib/lib/ant-contrib.jar + +# Clear up space +RUN rm /tmp/jdk17.tar.gz /tmp/ant.zip /tmp/ant-contrib.tgz /tmp/jdk17.sig + +# Set up jenkins user +RUN useradd -m -d /home/jenkins jenkins +RUN mkdir /home/jenkins/.ssh +RUN echo "Jenkins_User_SSHKey" > /home/jenkins/.ssh/authorized_keys +RUN chown -R jenkins /home/jenkins/.ssh +RUN chmod -R og-rwx /home/jenkins/.ssh + +RUN service ssh start +CMD ["/usr/sbin/sshd","-D"] + +RUN apt-get update && apt-get install -qq -y git curl make gcc xvfb libxrender1 libxi6 libxtst6 locales fontconfig fakeroot +# Install SSL Test packages +RUN apt-get install -qq -y gnutls-bin libnss3 libnss3-tools libnss3-dev pkg-config + +RUN locale-gen en_US.utf8 + +EXPOSE 22 +# Start with docker run -p 2226:22 UUID From e8ed768d13c29db57378ecb5b1b14146ad52b118 Mon Sep 17 00:00:00 2001 From: Haroon Khel Date: Thu, 15 Feb 2024 13:04:59 +0000 Subject: [PATCH 26/26] add comments to new tasks --- ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml | 2 ++ .../roles/deploy_container/tasks/deploy.yml | 3 ++- .../roles/deploy_container/tasks/main.yml | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml index 160ca89a3b..50fa31134a 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/dockernode.yml @@ -2,6 +2,8 @@ ############################### # Adoptium - Ansible Playbook # ############################### +# This playbook is used to deploy static docker containers onto dockerhost machines +# https://github.com/adoptium/infrastructure/issues/3370 - name: Dockernode playbook hosts: all diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml index 07f2e726ff..f6382e7038 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/deploy.yml @@ -1,10 +1,11 @@ --- - +# Dockerfiles are transferred from the controller node onto the dockerhost to be used to build and run docker containers - name: Transfer dockerfile copy: src: "roles/DockerStatic/Dockerfiles/Dockerfile.{{ docker_image }}" dest: "/tmp/Dockerfile.{{ docker_image }}" +# For images built on non x86_64 dockerhosts - name: Translate architecture in dockerfile replace: dest: /tmp/Dockerfile.{{ docker_image }} diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml index 33f88d085e..728d9d3680 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/deploy_container/tasks/main.yml @@ -1,5 +1,6 @@ --- - +# This task verifies the docker_images arguments passed into the playbook +# Then runs the deploy.yml task to build and run each image on the dockerhost - name: Set docker images list variable set_fact: docker_images_list: "{{ docker_images.split(',') | list }}"