Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite playbook logic #327

Merged
merged 5 commits into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Read, and fill the Pull Request template
* If this is a fix for a typo (in code, documentation, or the README) please file an issue and let us sort it out. We do not need a PR
* If the PR is addressing an existing issue include, closes #\<issue number>, in the body of the PR commit message
* If you want to discuss changes, you can also bring it up in [#dev-talk](https://discordapp.com/channels/354974912613449730/757585807061155840) in our [Discord server](https://discord.gg/YWrKVTn)
* If you want to discuss changes, you can also bring it up in [#dev-talk](https://discordapp.com/channels/354974912613449730/757585807061155840) in our [Discord server](https://linuxserver.io/discord)

## Common files

Expand Down
Empty file modified .github/FUNDING.yml
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
blank_issues_enabled: false
contact_links:
- name: Discord chat support
url: https://discord.gg/YWrKVTn
url: https://linuxserver.io/discord
about: Realtime support / chat with the community and the team.

- name: Discourse discussion forum
Expand Down
Empty file modified .github/ISSUE_TEMPLATE/issue.bug.yml
100755 → 100644
Empty file.
Empty file modified .github/ISSUE_TEMPLATE/issue.feature.yml
100755 → 100644
Empty file.
Empty file modified .github/workflows/call_issue_pr_tracker.yml
100755 → 100644
Empty file.
Empty file modified .github/workflows/call_issues_cron.yml
100755 → 100644
Empty file.
5 changes: 5 additions & 0 deletions .github/workflows/external_trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ jobs:
echo "Type is \`os\`" >> $GITHUB_STEP_SUMMARY
echo "No external release, exiting" >> $GITHUB_STEP_SUMMARY
exit 0
if grep -q "^jenkins-builder_master_${EXT_RELEASE}" <<< "${SKIP_EXTERNAL_TRIGGER}"; then
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
echo "> Github organizational variable \`SKIP_EXTERNAL_TRIGGER\` matches current external release; skipping trigger." >> $GITHUB_STEP_SUMMARY
exit 0
fi
Empty file modified .github/workflows/greetings.yml
100755 → 100644
Empty file.
Empty file modified .github/workflows/permissions.yml
100755 → 100644
Empty file.
16 changes: 10 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
16 changes: 10 additions & 6 deletions Dockerfile.aarch64
Original file line number Diff line number Diff line change
@@ -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"]
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Empty file modified LICENSE
100755 → 100644
Empty file.
19 changes: 19 additions & 0 deletions ansible/README.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 2 additions & 0 deletions ansible/ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[defaults]
inventory = inventory.ini
File renamed without changes.
File renamed without changes.
85 changes: 85 additions & 0 deletions ansible/generate.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions ansible/inventory.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[local]
localhost ansible_connection=local ansible_python_interpreter={{ansible_playbook_python}}
41 changes: 41 additions & 0 deletions ansible/roles/deprecate/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -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"
69 changes: 69 additions & 0 deletions ansible/roles/documentation/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -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"
69 changes: 69 additions & 0 deletions ansible/roles/github/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -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
Loading