diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml old mode 100755 new mode 100644 diff --git a/.github/ISSUE_TEMPLATE/issue.bug.yml b/.github/ISSUE_TEMPLATE/issue.bug.yml old mode 100755 new mode 100644 diff --git a/.github/ISSUE_TEMPLATE/issue.feature.yml b/.github/ISSUE_TEMPLATE/issue.feature.yml old mode 100755 new mode 100644 diff --git a/.github/workflows/call_issue_pr_tracker.yml b/.github/workflows/call_issue_pr_tracker.yml old mode 100755 new mode 100644 diff --git a/.github/workflows/call_issues_cron.yml b/.github/workflows/call_issues_cron.yml old mode 100755 new mode 100644 diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml old mode 100755 new mode 100644 diff --git a/.github/workflows/permissions.yml b/.github/workflows/permissions.yml old mode 100755 new mode 100644 diff --git a/Dockerfile b/Dockerfile index 492725c5..d5cb0945 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,27 @@ # syntax=docker/dockerfile:1 -FROM ghcr.io/linuxserver/baseimage-alpine:3.20 +FROM ghcr.io/linuxserver/baseimage-alpine:3.21 # set version label ARG BUILD_DATE ARG VERSION LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" -LABEL maintainer="homer, thelamer" +LABEL maintainer="roxedus, thelamer" RUN \ echo "**** install build packages ****" && \ - VERSION=v4.34.1 &&\ - wget https://github.com/mikefarah/yq/releases/download/${VERSION}/yq_linux_amd64 -O /usr/bin/yq &&\ + YQ_VERSION=v4.45.1 &&\ + wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64 -O /usr/bin/yq &&\ chmod +x /usr/bin/yq && \ apk add --no-cache --upgrade \ ansible && \ + printf "Linuxserver.io version: ${VERSION}\nBuild-date: ${BUILD_DATE}\n" > /build_version && \ apk del \ alpine-release -COPY . /ansible +COPY /ansible /app +COPY entrypoint.sh entrypoint.sh -ENTRYPOINT [ "/ansible/entrypoint.sh" ] +WORKDIR /app + +ENTRYPOINT ["catatonit", "--", "/entrypoint.sh"] diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 5273e15f..c4b01857 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,23 +1,27 @@ # syntax=docker/dockerfile:1 -FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.20 +FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.21 # set version label ARG BUILD_DATE ARG VERSION LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" -LABEL maintainer="homer, thelamer" +LABEL maintainer="roxedus, thelamer" RUN \ echo "**** install build packages ****" && \ - VERSION=v4.34.1 &&\ - wget https://github.com/mikefarah/yq/releases/download/${VERSION}/yq_linux_arm64 -O /usr/bin/yq &&\ + YQ_VERSION=v4.45.1 &&\ + wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_arm64 -O /usr/bin/yq &&\ chmod +x /usr/bin/yq && \ apk add --no-cache --upgrade \ ansible && \ + printf "Linuxserver.io version: ${VERSION}\nBuild-date: ${BUILD_DATE}\n" > /build_version && \ apk del \ alpine-release -COPY . /ansible +COPY /ansible /app +COPY entrypoint.sh entrypoint.sh -ENTRYPOINT [ "/ansible/entrypoint.sh" ] +WORKDIR /app + +ENTRYPOINT ["catatonit", "--", "/entrypoint.sh"] diff --git a/Jenkinsfile b/Jenkinsfile index e6ea7620..a1dc14d1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,7 +29,7 @@ pipeline { DIST_IMAGE='alpine' MULTIARCH='true' CI='true' - CI_WEB='true' + CI_WEB='false' CI_PORT='8000' CI_SSL='false' CI_DELAY='60' diff --git a/LICENSE b/LICENSE old mode 100755 new mode 100644 diff --git a/ansible/README.md b/ansible/README.md new file mode 100644 index 00000000..434a833a --- /dev/null +++ b/ansible/README.md @@ -0,0 +1,19 @@ +# Ansible + +## filter_plugins/ + +Houses custom jinja filters. + +- admonition.py + - Creates admonitions in different syntax' based on the markdown output format + +## Roles + + +## ansible.cfg + +This overwrites/sets some Ansible configuration, mainly the inventory in this case. + +## inventory.ini + +This file sets up the localhost host, the same way Ansible would without the file, without logging "implicit localhost" in the output. diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg new file mode 100644 index 00000000..1da4684b --- /dev/null +++ b/ansible/ansible.cfg @@ -0,0 +1,2 @@ +[defaults] +inventory = inventory.ini diff --git a/roles/generate-jenkins/templates/common_macros.j2 b/ansible/common_macros.j2 similarity index 100% rename from roles/generate-jenkins/templates/common_macros.j2 rename to ansible/common_macros.j2 diff --git a/filter_plugins/admonition.py b/ansible/filter_plugins/admonition.py similarity index 100% rename from filter_plugins/admonition.py rename to ansible/filter_plugins/admonition.py diff --git a/ansible/generate.yml b/ansible/generate.yml new file mode 100644 index 00000000..4a06e39c --- /dev/null +++ b/ansible/generate.yml @@ -0,0 +1,85 @@ +--- +- hosts: localhost + vars_files: + - vars/common.yml + - vars/default.yml + pre_tasks: + - name: Set container_name + tags: [ "always" ] + changed_when: false + set_fact: + container_name: "{{ lookup('env', 'CONTAINER_NAME' ) | default(omit) }}" + + - name: Set github_branch + tags: [ "always" ] + changed_when: false + set_fact: + github_branch: "{{ lookup('env', 'GITHUB_BRANCH' ) | default(omit) }}" + + - name: Set UID + tags: [ "always" ] + changed_when: false + when: lookup('env', 'PUID') + user: + name: abc + non_unique: yes + uid: "{{ lookup('env', 'PUID') | int }}" + + - name: Set GID + tags: [ "always" ] + changed_when: false + when: lookup('env', 'PGID') + group: + name: abc + non_unique: yes + gid: "{{ lookup('env', 'PGID') | int }}" + + - name: Set noter + tags: [ "always" ] + changed_when: false + set_fact: + noter: "{{ lookup('template', 'common_macros.j2') | trim}}" + + - name: Include var files for this project + tags: [ "always" ] + include_vars: + file: "/tmp/{{ item }}" + loop: + - 'jenkins-vars.yml' + - 'readme-vars.yml' + + tasks: + + - name: Add deprecation in S6 + ansible.builtin.include_role: + name: deprecate + when: + project_deprecation_status == true + + - name: Setup .github meta directory + tags: + - github + ansible.builtin.include_role: + name: github + apply: + tags: + - github + + - name: Generate documentation + tags: + - documentation + - external + - mkdocs + - readme + - unraid + ansible.builtin.include_role: + name: documentation + + - name: Generate Repository + tags: + - repository + ansible.builtin.include_role: + name: repository + apply: + tags: + - repository diff --git a/ansible/inventory.ini b/ansible/inventory.ini new file mode 100644 index 00000000..e03c771c --- /dev/null +++ b/ansible/inventory.ini @@ -0,0 +1,2 @@ +[local] +localhost ansible_connection=local ansible_python_interpreter={{ansible_playbook_python}} diff --git a/ansible/roles/deprecate/tasks/main.yml b/ansible/roles/deprecate/tasks/main.yml new file mode 100644 index 00000000..d064f8b4 --- /dev/null +++ b/ansible/roles/deprecate/tasks/main.yml @@ -0,0 +1,41 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/ansible.json#/$defs/tasks + +- name: Create deprecation directories + file: + path: "/tmp/{{ item }}" + state: directory + owner: "abc" + group: "abc" + mode: "0755" + loop: + - root/etc/s6-overlay/s6-rc.d/init-deprecate/dependencies.d + - root/etc/s6-overlay/s6-rc.d/init-services/dependencies.d + +- name: Create deprecation files + file: + path: "/tmp/{{ item }}" + state: touch + owner: "abc" + group: "abc" + loop: + - root/etc/s6-overlay/s6-rc.d/init-deprecate/dependencies.d/init-config-end + - root/etc/s6-overlay/s6-rc.d/init-deprecate/up + - root/etc/s6-overlay/s6-rc.d/init-services/dependencies.d/init-deprecate + - root/etc/s6-overlay/s6-rc.d/user/contents.d/init-deprecate + +- name: Populate file for init-deprecate/type + copy: + dest: /tmp/root/etc/s6-overlay/s6-rc.d/init-deprecate/type + content: | + oneshot + owner: "abc" + group: "abc" + +- name: Populate file for init-deprecate/up + template: + src: deprecation.j2 + dest: /tmp/root/etc/s6-overlay/s6-rc.d/init-deprecate/run + owner: "abc" + group: "abc" + mode: "0755" diff --git a/roles/generate-jenkins/templates/99-deprecation.j2 b/ansible/roles/deprecate/templates/deprecation.j2 similarity index 100% rename from roles/generate-jenkins/templates/99-deprecation.j2 rename to ansible/roles/deprecate/templates/deprecation.j2 diff --git a/ansible/roles/documentation/tasks/main.yml b/ansible/roles/documentation/tasks/main.yml new file mode 100644 index 00000000..59c660e6 --- /dev/null +++ b/ansible/roles/documentation/tasks/main.yml @@ -0,0 +1,69 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/ansible.json#/$defs/tasks + +- name: Create Jenkins external directories + tags: + - documentation + - external + - mkdocs + - readme + - unraid + file: + path: "/tmp/.jenkins-external" + state: directory + owner: "abc" + group: "abc" + mode: "0755" + +- name: Template Unraid template + tags: + - external + - unraid + when: + - unraid_template + - item.unraid_template is defined + - full_custom_readme is not defined + - '"baseimage" not in project_name' + - '"jenkins-builder" not in project_name' + template: + src: unraid.xml.j2 + dest: "/tmp/.jenkins-external/{{ project_name | lower }}.xml" + owner: "abc" + group: "abc" + mode: "0644" + +- name: Template MkDocs page + tags: + - documentation + - external + - mkdocs + template: + src: documentation{{'-custom' if full_custom_readme is defined }}.md.j2 + dest: "/tmp/.jenkins-external/{{ project_repo_name }}.md" + owner: "abc" + group: "abc" + mode: "0644" + +- name: Template lite README + tags: + - documentation + - external + - readme + template: + src: lite{{'-custom' if full_custom_readme is defined }}.md.j2 + dest: "/tmp/.jenkins-external/README.lite" + owner: "abc" + group: "abc" + mode: "0644" + +- name: Template README + tags: + - documentation + - external + - readme + template: + src: readme{{'-custom' if full_custom_readme is defined }}.md.j2 + dest: "/tmp/README.md" + owner: "abc" + group: "abc" + mode: "0644" diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/APPLICATION_SETUP.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/APPLICATION_SETUP.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/APPLICATION_SETUP.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/APPLICATION_SETUP.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/BUILDING_LOCALLY.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/BUILDING_LOCALLY.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/BUILDING_LOCALLY.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/BUILDING_LOCALLY.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/DEPRECATION.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/DEPRECATION.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/DEPRECATION.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/DEPRECATION.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/DOCKER_CLI.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/DOCKER_CLI.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/DOCKER_CLI.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/DOCKER_CLI.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/DOCKER_COMPOSE.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/DOCKER_COMPOSE.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/DOCKER_COMPOSE.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/DOCKER_COMPOSE.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/DOCKER_MODS.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/DOCKER_MODS.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/DOCKER_MODS.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/DOCKER_MODS.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/DO_NOT_EDIT.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/DO_NOT_EDIT.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/DO_NOT_EDIT.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/DO_NOT_EDIT.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/ENV_VAR_FILES.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/ENV_VAR_FILES.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/ENV_VAR_FILES.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/ENV_VAR_FILES.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/GROUP_BADGES.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/GROUP_BADGES.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/GROUP_BADGES.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/GROUP_BADGES.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/GROUP_INFO.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/GROUP_INFO.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/GROUP_INFO.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/GROUP_INFO.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/HWACCEL.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/HWACCEL.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/HWACCEL.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/HWACCEL.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/KASM.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/KASM.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/KASM.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/KASM.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/KEYBOARD.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/KEYBOARD.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/KEYBOARD.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/KEYBOARD.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/MEDIA.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/MEDIA.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/MEDIA.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/MEDIA.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/NONROOT.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/NONROOT.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/NONROOT.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/NONROOT.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/OPTIONAL_PARAMETERS.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/OPTIONAL_PARAMETERS.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/OPTIONAL_PARAMETERS.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/OPTIONAL_PARAMETERS.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/PROJECT_BADGES.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/PROJECT_BADGES.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/PROJECT_BADGES.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/PROJECT_BADGES.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/READONLY.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/READONLY.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/READONLY.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/READONLY.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/SECCOMP.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/SECCOMP.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/SECCOMP.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/SECCOMP.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/STRICT_PROXY.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/STRICT_PROXY.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/STRICT_PROXY.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/STRICT_PROXY.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/SUPPORTED_ARCHITECTURES.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/SUPPORTED_ARCHITECTURES.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/SUPPORTED_ARCHITECTURES.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/SUPPORTED_ARCHITECTURES.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/SUPPORT_INFO.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/SUPPORT_INFO.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/SUPPORT_INFO.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/SUPPORT_INFO.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/UMASK.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/UMASK.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/UMASK.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/UMASK.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/UPDATING_INFO.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/UPDATING_INFO.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/UPDATING_INFO.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/UPDATING_INFO.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/USAGE.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/USAGE.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/USAGE.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/USAGE.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/USER_GROUP_IDENTIFIERS.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/USER_GROUP_IDENTIFIERS.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/USER_GROUP_IDENTIFIERS.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/USER_GROUP_IDENTIFIERS.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/VERSIONS.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/VERSIONS.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/VERSIONS.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/VERSIONS.j2 diff --git a/roles/generate-jenkins/templates/README_SNIPPETS/VERSION_TAGS.j2 b/ansible/roles/documentation/templates/README_SNIPPETS/VERSION_TAGS.j2 similarity index 100% rename from roles/generate-jenkins/templates/README_SNIPPETS/VERSION_TAGS.j2 rename to ansible/roles/documentation/templates/README_SNIPPETS/VERSION_TAGS.j2 diff --git a/roles/generate-jenkins/templates/DOCUMENTATION.j2-CUSTOM b/ansible/roles/documentation/templates/documentation-custom.md.j2 similarity index 100% rename from roles/generate-jenkins/templates/DOCUMENTATION.j2-CUSTOM rename to ansible/roles/documentation/templates/documentation-custom.md.j2 diff --git a/roles/generate-jenkins/templates/DOCUMENTATION.j2 b/ansible/roles/documentation/templates/documentation.md.j2 similarity index 100% rename from roles/generate-jenkins/templates/DOCUMENTATION.j2 rename to ansible/roles/documentation/templates/documentation.md.j2 diff --git a/roles/generate-jenkins/templates/lite.j2-CUSTOM b/ansible/roles/documentation/templates/lite-custom.md.j2 similarity index 100% rename from roles/generate-jenkins/templates/lite.j2-CUSTOM rename to ansible/roles/documentation/templates/lite-custom.md.j2 diff --git a/roles/generate-jenkins/templates/lite.j2 b/ansible/roles/documentation/templates/lite.md.j2 similarity index 100% rename from roles/generate-jenkins/templates/lite.j2 rename to ansible/roles/documentation/templates/lite.md.j2 diff --git a/roles/generate-jenkins/templates/README.j2-CUSTOM b/ansible/roles/documentation/templates/readme-custom.md.j2 similarity index 100% rename from roles/generate-jenkins/templates/README.j2-CUSTOM rename to ansible/roles/documentation/templates/readme-custom.md.j2 diff --git a/roles/generate-jenkins/templates/README.j2 b/ansible/roles/documentation/templates/readme.md.j2 similarity index 100% rename from roles/generate-jenkins/templates/README.j2 rename to ansible/roles/documentation/templates/readme.md.j2 diff --git a/roles/generate-jenkins/templates/UNRAID_TEMPLATE.j2 b/ansible/roles/documentation/templates/unraid.xml.j2 similarity index 100% rename from roles/generate-jenkins/templates/UNRAID_TEMPLATE.j2 rename to ansible/roles/documentation/templates/unraid.xml.j2 diff --git a/ansible/roles/github/tasks/main.yml b/ansible/roles/github/tasks/main.yml new file mode 100644 index 00000000..e56820c1 --- /dev/null +++ b/ansible/roles/github/tasks/main.yml @@ -0,0 +1,69 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/ansible.json#/$defs/tasks + +- name: Create .github directories + file: + path: "/tmp/{{ item }}" + state: directory + owner: "abc" + group: "abc" + mode: "0755" + loop: + - .github/ISSUE_TEMPLATE + - .github/workflows + +- name: Populate Github workflows + template: + src: "{{ item }}.j2" + dest: "/tmp/.github/workflows/{{ item }}" + owner: "abc" + group: "abc" + mode: "0644" + loop: + - call_issue_pr_tracker.yml + - call_issues_cron.yml + - external_trigger_scheduler.yml + - external_trigger.yml + - greetings.yml + - package_trigger_scheduler.yml + - permissions.yml + +- name: Populate conditional Github workflows + when: item.when + template: + src: "{{ item.file }}.j2" + dest: "/tmp/.github/workflows/{{ item.file }}" + owner: "abc" + group: "abc" + mode: "0644" + loop: + - file: package_trigger_scheduler.yml + when: custom_package_trigger != true + - file: external_trigger_scheduler.yml + when: custom_external_trigger != true + - file: external_trigger.yml + when: custom_external_trigger != true + +- name: Populate Github issue templates + template: + src: "{{ item }}.j2" + dest: "/tmp/.github/ISSUE_TEMPLATE/{{ item }}" + owner: "abc" + group: "abc" + mode: "0644" + loop: + - issue.bug.yml + - config.yml + - issue.feature.yml + +- name: Populate Github metadata + template: + src: "{{ item }}.j2" + dest: "/tmp/.github/{{ item }}" + owner: "abc" + group: "abc" + mode: "0644" + loop: + - CONTRIBUTING.md + - FUNDING.yml + - PULL_REQUEST_TEMPLATE.md diff --git a/roles/generate-jenkins/templates/CONTRIBUTING.j2 b/ansible/roles/github/templates/CONTRIBUTING.md.j2 similarity index 100% rename from roles/generate-jenkins/templates/CONTRIBUTING.j2 rename to ansible/roles/github/templates/CONTRIBUTING.md.j2 diff --git a/roles/generate-jenkins/templates/FUNDING.j2 b/ansible/roles/github/templates/FUNDING.yml.j2 similarity index 100% rename from roles/generate-jenkins/templates/FUNDING.j2 rename to ansible/roles/github/templates/FUNDING.yml.j2 diff --git a/roles/generate-jenkins/templates/PULL_REQUEST_TEMPLATE.j2 b/ansible/roles/github/templates/PULL_REQUEST_TEMPLATE.md.j2 similarity index 97% rename from roles/generate-jenkins/templates/PULL_REQUEST_TEMPLATE.j2 rename to ansible/roles/github/templates/PULL_REQUEST_TEMPLATE.md.j2 index 3fb4abad..c7991823 100644 --- a/roles/generate-jenkins/templates/PULL_REQUEST_TEMPLATE.j2 +++ b/ansible/roles/github/templates/PULL_REQUEST_TEMPLATE.md.j2 @@ -1,5 +1,5 @@ {%- set markdown="gfm" -%} -{% from 'common_macros.j2' import noter with context %} +{{- noter -}} {% if project_deprecation_status %} {% include "README_SNIPPETS/DEPRECATION.j2" | trim %} diff --git a/roles/generate-jenkins/templates/CALL_ISSUE_PR_TRACKER.j2 b/ansible/roles/github/templates/call_issue_pr_tracker.yml.j2 similarity index 100% rename from roles/generate-jenkins/templates/CALL_ISSUE_PR_TRACKER.j2 rename to ansible/roles/github/templates/call_issue_pr_tracker.yml.j2 diff --git a/roles/generate-jenkins/templates/CALL_WORKFLOW_ISSUES_CRON.j2 b/ansible/roles/github/templates/call_issues_cron.yml.j2 similarity index 100% rename from roles/generate-jenkins/templates/CALL_WORKFLOW_ISSUES_CRON.j2 rename to ansible/roles/github/templates/call_issues_cron.yml.j2 diff --git a/roles/generate-jenkins/templates/ISSUE_TEMPLATE.config.j2 b/ansible/roles/github/templates/config.yml.j2 similarity index 100% rename from roles/generate-jenkins/templates/ISSUE_TEMPLATE.config.j2 rename to ansible/roles/github/templates/config.yml.j2 diff --git a/roles/generate-jenkins/templates/EXTERNAL_TRIGGER.j2 b/ansible/roles/github/templates/external_trigger.yml.j2 similarity index 100% rename from roles/generate-jenkins/templates/EXTERNAL_TRIGGER.j2 rename to ansible/roles/github/templates/external_trigger.yml.j2 diff --git a/roles/generate-jenkins/templates/EXTERNAL_TRIGGER_SCHEDULER.j2 b/ansible/roles/github/templates/external_trigger_scheduler.yml.j2 similarity index 100% rename from roles/generate-jenkins/templates/EXTERNAL_TRIGGER_SCHEDULER.j2 rename to ansible/roles/github/templates/external_trigger_scheduler.yml.j2 diff --git a/roles/generate-jenkins/templates/greetings.j2 b/ansible/roles/github/templates/greetings.yml.j2 similarity index 100% rename from roles/generate-jenkins/templates/greetings.j2 rename to ansible/roles/github/templates/greetings.yml.j2 diff --git a/roles/generate-jenkins/templates/ISSUE_TEMPLATE.bug.j2 b/ansible/roles/github/templates/issue.bug.yml.j2 similarity index 97% rename from roles/generate-jenkins/templates/ISSUE_TEMPLATE.bug.j2 rename to ansible/roles/github/templates/issue.bug.yml.j2 index a63705c7..7e7b5bfa 100644 --- a/roles/generate-jenkins/templates/ISSUE_TEMPLATE.bug.j2 +++ b/ansible/roles/github/templates/issue.bug.yml.j2 @@ -1,5 +1,5 @@ {%- set markdown="gfm" -%} -{% from 'common_macros.j2' import noter with context %} +{{- noter -}} # Based on the issue template name: Bug report description: Create a report to help us improve diff --git a/roles/generate-jenkins/templates/ISSUE_TEMPLATE.feature.j2 b/ansible/roles/github/templates/issue.feature.yml.j2 similarity index 95% rename from roles/generate-jenkins/templates/ISSUE_TEMPLATE.feature.j2 rename to ansible/roles/github/templates/issue.feature.yml.j2 index 008102df..446e68ea 100644 --- a/roles/generate-jenkins/templates/ISSUE_TEMPLATE.feature.j2 +++ b/ansible/roles/github/templates/issue.feature.yml.j2 @@ -1,5 +1,5 @@ {%- set markdown="gfm" -%} -{% from 'common_macros.j2' import noter with context %} +{{- noter -}} # Based on the issue template name: Feature request description: Suggest an idea for this project diff --git a/roles/generate-jenkins/templates/PACKAGE_TRIGGER_SCHEDULER.j2 b/ansible/roles/github/templates/package_trigger_scheduler.yml.j2 similarity index 100% rename from roles/generate-jenkins/templates/PACKAGE_TRIGGER_SCHEDULER.j2 rename to ansible/roles/github/templates/package_trigger_scheduler.yml.j2 diff --git a/roles/generate-jenkins/templates/permissions.j2 b/ansible/roles/github/templates/permissions.yml.j2 similarity index 100% rename from roles/generate-jenkins/templates/permissions.j2 rename to ansible/roles/github/templates/permissions.yml.j2 diff --git a/ansible/roles/repository/tasks/main.yml b/ansible/roles/repository/tasks/main.yml new file mode 100644 index 00000000..c9b59a58 --- /dev/null +++ b/ansible/roles/repository/tasks/main.yml @@ -0,0 +1,34 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/ansible.json#/$defs/tasks + +- name: Create Root directory for donation + when: + - sponsor_links is defined + file: + path: "/tmp/root" + state: directory + owner: "abc" + group: "abc" + mode: "0755" + +- name: Populate donation file + when: + - sponsor_links is defined + template: + src: donate.txt.j2 + dest: /tmp/root/donate.txt + owner: "abc" + group: "abc" + mode: "0644" + +- name: Populate Repository files + template: + src: "{{ item }}.j2" + dest: "/tmp/{{ item }}" + owner: "abc" + group: "abc" + mode: "0644" + loop: + - .editorconfig + - Jenkinsfile + - LICENSE diff --git a/roles/generate-jenkins/templates/.editorconfig.j2 b/ansible/roles/repository/templates/.editorconfig.j2 similarity index 100% rename from roles/generate-jenkins/templates/.editorconfig.j2 rename to ansible/roles/repository/templates/.editorconfig.j2 diff --git a/roles/generate-jenkins/templates/Jenkinsfile.j2 b/ansible/roles/repository/templates/Jenkinsfile.j2 similarity index 100% rename from roles/generate-jenkins/templates/Jenkinsfile.j2 rename to ansible/roles/repository/templates/Jenkinsfile.j2 diff --git a/roles/generate-jenkins/templates/LICENSE.j2 b/ansible/roles/repository/templates/LICENSE.j2 similarity index 100% rename from roles/generate-jenkins/templates/LICENSE.j2 rename to ansible/roles/repository/templates/LICENSE.j2 diff --git a/roles/generate-jenkins/templates/DONATE.j2 b/ansible/roles/repository/templates/donate.txt.j2 similarity index 100% rename from roles/generate-jenkins/templates/DONATE.j2 rename to ansible/roles/repository/templates/donate.txt.j2 diff --git a/vars/_container-vars-blank b/ansible/vars/_container-vars-blank similarity index 100% rename from vars/_container-vars-blank rename to ansible/vars/_container-vars-blank diff --git a/vars/common b/ansible/vars/common.yml similarity index 100% rename from vars/common rename to ansible/vars/common.yml diff --git a/roles/generate-jenkins/defaults/main.yml b/ansible/vars/default.yml similarity index 94% rename from roles/generate-jenkins/defaults/main.yml rename to ansible/vars/default.yml index 8402d8e0..f4b9b6a7 100644 --- a/roles/generate-jenkins/defaults/main.yml +++ b/ansible/vars/default.yml @@ -1,10 +1,7 @@ --- - github_branch: master github_user: linuxserver -templated_vars: - - 'jenkins-vars.yml' - - 'readme-vars.yml' + project_blurb_optional_extras_enabled: false project_blurb_optional_extras: [] available_architectures: [] @@ -60,5 +57,5 @@ armhf_native: false build_armhf: false image_provenance: true image_sbom: true -image_builder: 'container' +image_builder: "container" project_categories: "" diff --git a/entrypoint.sh b/entrypoint.sh index 2ce96685..41204c3a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,9 +1,9 @@ #! /bin/bash +cat /build_version + if [[ -z "${CI_RUN}" ]]; then - cd /ansible - ansible-playbook generate.yml ${EXTRA_PLAYBOOK_PARAM} + ansible-playbook generate.yml "$@" else echo '[ls.io-init] done.' - python3 /ansible/server.py fi diff --git a/generate.yml b/generate.yml deleted file mode 100644 index f20cca7a..00000000 --- a/generate.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -- hosts: localhost - vars_files: - - vars/common - pre_tasks: - - name: Set container_name - set_fact: - container_name: "{{ lookup('env', 'CONTAINER_NAME' ) | default(omit) }}" - - name: Set github_branch - set_fact: - github_branch: "{{ lookup('env', 'GITHUB_BRANCH' ) | default(omit) }}" - roles: - - { role: roles/generate-jenkins } diff --git a/jenkins-vars.yml b/jenkins-vars.yml index 0d499901..821d5baa 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -16,7 +16,7 @@ repo_vars: - DIST_IMAGE='alpine' - MULTIARCH='true' - CI='true' - - CI_WEB='true' + - CI_WEB='false' - CI_PORT='8000' - CI_SSL='false' - CI_DELAY='60' diff --git a/jenkins/.placeholder b/jenkins/.placeholder deleted file mode 100644 index e69de29b..00000000 diff --git a/roles/generate-jenkins/tasks/main.yml b/roles/generate-jenkins/tasks/main.yml deleted file mode 100644 index 70a7c35b..00000000 --- a/roles/generate-jenkins/tasks/main.yml +++ /dev/null @@ -1,288 +0,0 @@ ---- -####################### -# Set UID and GID # -####################### - -- name: set UID - when: lookup('env', 'PUID') - user: - name: abc - non_unique: yes - uid: "{{ lookup('env', 'PUID') | int }}" -- name: set GID - when: lookup('env', 'PGID') - group: - name: abc - non_unique: yes - gid: "{{ lookup('env', 'PGID') | int }}" - -###################################### -# Grab the Variables from github # -###################################### -- name: include var files for this project - include_vars: - file: "/tmp/{{ item }}" - loop: "{{ templated_vars }}" - -- name: include template loop variables - include_vars: - file: "/ansible/roles/generate-jenkins/templates.yml" - -############################ -# Directory Management # -############################ -- name: create destination dir for generated github files - file: - path: "/tmp/.github" - state: directory - owner: "abc" - group: "abc" - -- name: set basefolder - set_fact: - project_base: "/tmp" - -- name: set vars basefolder - set_fact: - dl_vars_project_base: /tmp - -- name: create destination dir for generated github workflow files - file: - path: "/tmp/.github/workflows" - state: directory - owner: "abc" - group: "abc" - -- name: create destination dir for generated github ISSUE_TEMPLATE files - file: - path: "/tmp/.github/ISSUE_TEMPLATE" - state: directory - owner: "abc" - group: "abc" - -- name: create destination dir for generated donate.txt - when: - - sponsor_links is defined - file: - path: "/tmp/root" - state: directory - owner: "abc" - group: "abc" - -- name: create destination dir for generated 99-deprecation - when: - - project_deprecation_status == true - file: - path: "/tmp/root/etc/cont-init.d" - state: directory - owner: "abc" - group: "abc" - -- name: deprecate - create dir for init-services/dependencies.d - when: - - project_deprecation_status == true - file: - path: "/tmp/root/etc/s6-overlay/s6-rc.d/init-services/dependencies.d" - state: directory - owner: "abc" - group: "abc" - -- name: deprecate - create file for init-services/dependencies.d/init-deprecate - when: - - project_deprecation_status == true - file: - path: "/tmp/root/etc/s6-overlay/s6-rc.d/init-services/dependencies.d/init-deprecate" - state: touch - owner: "abc" - group: "abc" - -- name: deprecate - create dir for init-deprecate/dependencies.d - when: - - project_deprecation_status == true - file: - path: "/tmp/root/etc/s6-overlay/s6-rc.d/init-deprecate/dependencies.d" - state: directory - owner: "abc" - group: "abc" - -- name: deprecate - create file for init-deprecate/dependencies.d/init-config-end - when: - - project_deprecation_status == true - file: - path: "/tmp/root/etc/s6-overlay/s6-rc.d/init-deprecate/dependencies.d/init-config-end" - state: touch - owner: "abc" - group: "abc" - -- name: deprecate - create file for init-deprecate/type - when: - - project_deprecation_status == true - file: - path: "/tmp/root/etc/s6-overlay/s6-rc.d/init-deprecate/type" - state: touch - owner: "abc" - group: "abc" - -- name: deprecate - populate file for init-deprecate/type - when: - - project_deprecation_status == true - copy: - dest: "/tmp/root/etc/s6-overlay/s6-rc.d/init-deprecate/type" - content: | - oneshot - -- name: deprecate - create file for init-deprecate/up - when: - - project_deprecation_status == true - file: - path: "/tmp/root/etc/s6-overlay/s6-rc.d/init-deprecate/up" - state: touch - owner: "abc" - group: "abc" - -- name: deprecate - populate file for init-deprecate/up - when: - - project_deprecation_status == true - copy: - dest: "/tmp/root/etc/s6-overlay/s6-rc.d/init-deprecate/up" - content: | - /etc/s6-overlay/s6-rc.d/init-deprecate/run - -- name: deprecate - create file for user/contents.d/init-deprecate - when: - - project_deprecation_status == true - file: - path: "/tmp/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-deprecate" - state: touch - owner: "abc" - group: "abc" - -- name: create destination dir for generated external files - file: - path: "/tmp/.jenkins-external" - state: directory - owner: "abc" - group: "abc" - -############################## -# Loop Through Templates # -############################## - -# Normal Files - -- name: write templates - when: - - item.readme is not defined - - item.donate is not defined - - item.deprecation is not defined - - item.unraid_template is not defined - - item.package_trigger is not defined - - item.external_trigger is not defined - template: - src: "../templates/{{ item.src }}" - dest: "/tmp/{{ item.dest }}" - owner: "abc" - group: "abc" - delegate_to: localhost - loop: "{{ templated_files }}" - -# Readme templating - -- name: write readme normal - when: - - item.readme is defined - - full_custom_readme is not defined - template: - src: "../templates/{{ item.src }}" - dest: "/tmp/{{ item.dest }}" - owner: "abc" - group: "abc" - delegate_to: localhost - loop: "{{ templated_files }}" - -- name: write readme full custom - when: - - item.readme is defined - - full_custom_readme is defined - template: - src: "../templates/{{ item.src }}-CUSTOM" - dest: "/tmp/{{ item.dest }}" - owner: "abc" - group: "abc" - delegate_to: localhost - loop: "{{ templated_files }}" - -# Donation links templating - -- name: write donation links - when: - - item.donate is defined - - sponsor_links is defined - template: - src: "../templates/{{ item.src }}" - dest: "/tmp/{{ item.dest }}" - owner: "abc" - group: "abc" - delegate_to: localhost - loop: "{{ templated_files }}" - -# Deprecation init script templating - -- name: write deprecation init script - when: - - item.deprecation is defined - - project_deprecation_status == true - template: - src: "../templates/{{ item.src }}" - dest: "/tmp/{{ item.dest }}" - owner: "abc" - group: "abc" - mode: 0755 - delegate_to: localhost - loop: "{{ templated_files }}" - - -# Unraid template templating - -- name: write Unraid template - when: - - unraid_template - - item.unraid_template is defined - - full_custom_readme is not defined - - '"baseimage" not in project_name' - - '"jenkins-builder" not in project_name' - template: - src: "../templates/{{ item.src }}" - dest: "/tmp/{{ item.dest }}" - owner: "abc" - group: "abc" - delegate_to: localhost - loop: "{{ templated_files }}" - -# Package trigger templating - -- name: write package trigger - when: - - item.package_trigger is defined - - custom_package_trigger != true - template: - src: "../templates/{{ item.src }}" - dest: "/tmp/{{ item.dest }}" - owner: "abc" - group: "abc" - delegate_to: localhost - loop: "{{ templated_files }}" - -# External trigger templating - -- name: write external trigger - when: - - item.external_trigger is defined - - custom_external_trigger != true - template: - src: "../templates/{{ item.src }}" - dest: "/tmp/{{ item.dest }}" - owner: "abc" - group: "abc" - delegate_to: localhost - loop: "{{ templated_files }}" diff --git a/roles/generate-jenkins/templates.yml b/roles/generate-jenkins/templates.yml deleted file mode 100644 index 779fa664..00000000 --- a/roles/generate-jenkins/templates.yml +++ /dev/null @@ -1,24 +0,0 @@ ---- -templated_files: - - { src: '.editorconfig.j2', dest: '.editorconfig' } - - { src: '99-deprecation.j2', dest: 'root/etc/s6-overlay/s6-rc.d/init-deprecate/run', deprecation: 'true' } - - { src: 'CONTRIBUTING.j2', dest: '.github/CONTRIBUTING.md' } - - { src: 'DOCUMENTATION.j2', dest: '.jenkins-external/{{ project_repo_name }}.md' , readme: 'true' } - - { src: 'DONATE.j2', dest: 'root/donate.txt' , donate: 'true' } - - { src: 'EXTERNAL_TRIGGER_SCHEDULER.j2', dest: '.github/workflows/external_trigger_scheduler.yml' } - - { src: 'EXTERNAL_TRIGGER.j2', dest: '.github/workflows/external_trigger.yml', external_trigger: 'true' } - - { src: 'FUNDING.j2', dest: '.github/FUNDING.yml' } - - { src: 'greetings.j2', dest: '.github/workflows/greetings.yml' } - - { src: 'ISSUE_TEMPLATE.bug.j2', dest: '.github/ISSUE_TEMPLATE/issue.bug.yml' } - - { src: 'ISSUE_TEMPLATE.config.j2', dest: '.github/ISSUE_TEMPLATE/config.yml' } - - { src: 'ISSUE_TEMPLATE.feature.j2', dest: '.github/ISSUE_TEMPLATE/issue.feature.yml' } - - { src: 'Jenkinsfile.j2', dest: 'Jenkinsfile' } - - { src: 'LICENSE.j2', dest: 'LICENSE' } - - { src: 'lite.j2', dest: '.jenkins-external/README.lite' , readme: 'true' } - - { src: 'PACKAGE_TRIGGER_SCHEDULER.j2', dest: '.github/workflows/package_trigger_scheduler.yml' } - - { src: 'PULL_REQUEST_TEMPLATE.j2', dest: '.github/PULL_REQUEST_TEMPLATE.md' } - - { src: 'README.j2', dest: 'README.md' , readme: 'true' } - - { src: 'UNRAID_TEMPLATE.j2', dest: '.jenkins-external/{{ project_name | lower }}.xml' , unraid_template: 'true' } - - { src: 'CALL_ISSUE_PR_TRACKER.j2', dest: '.github/workflows/call_issue_pr_tracker.yml' } - - { src: 'permissions.j2', dest: '.github/workflows/permissions.yml' } - - { src: 'CALL_WORKFLOW_ISSUES_CRON.j2', dest: '.github/workflows/call_issues_cron.yml' } diff --git a/roles/generate-jenkins/templates/.editorconfig b/roles/generate-jenkins/templates/.editorconfig deleted file mode 100644 index d9e6ac39..00000000 --- a/roles/generate-jenkins/templates/.editorconfig +++ /dev/null @@ -1,16 +0,0 @@ -# This file is globally distributed to all container image projects from -# https://github.com/linuxserver/docker-jenkins-builder/blob/master/.editorconfig - -# top-most EditorConfig file -root = true - -# Unix-style newlines with a newline ending every file -[*] -end_of_line = lf -insert_final_newline = true -# trim_trailing_whitespace may cause unintended issues and should not be globally set true -trim_trailing_whitespace = false - -[{**.yml,**.yml.j2}] -indent_style = space -indent_size = 2 diff --git a/root/etc/services.d/fake/run b/root/etc/services.d/fake/run deleted file mode 100755 index a525dc7f..00000000 --- a/root/etc/services.d/fake/run +++ /dev/null @@ -1,5 +0,0 @@ -#! /bin/python - -I only exist to loop test our shell checking system. - -echo $TEST > /test/testfile.txt diff --git a/server.py b/server.py deleted file mode 100644 index dcdb5702..00000000 --- a/server.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python - -from http.server import BaseHTTPRequestHandler,HTTPServer - -class Hello(BaseHTTPRequestHandler): - def do_GET(serv): - serv.send_response(200) - serv.send_header('Content-type', 'text/html; charset=utf-8') - serv.end_headers() - serv.wfile.write(bytes(''' - - - - - - -
- LINUXSERVER CI PAGE -
- - - ''', "utf8")) - -server = ('0.0.0.0', 8000) -httpd = HTTPServer(server, Hello) -httpd.serve_forever()