Compare commits

...

3 Commits

Author SHA1 Message Date
Jon
aa368e4bfb feat(docker): add alpine build
ref: #2 #1
2025-07-01 03:56:59 +09:30
Jon
a7b2145886 docs: add skeleton contributing guide
ref: #2 #1
2025-07-01 02:11:34 +09:30
Jon
ab3560bad3 chore: update galaxy meta files
ref: #2 #1
2025-07-01 02:10:21 +09:30
8 changed files with 223 additions and 21 deletions

View File

@ -1,3 +1,7 @@
.ansible
.git
CONTRIBUTING.md
docs/
# includes/
galaxy.yml
*.tmp.*

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
# Temp directories / files
.ansible/
artifacts/
*.tmp.*

5
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,5 @@
# Contribution Guide
Contributions welcome.
This doc is still a WIP.

View File

@ -1,45 +1,97 @@
FROM harbor.earth.nww/docker/python:3.11-slim
FROM python:3.11-alpine3.22 AS Build
RUN apt-get update; \
apt-get install -y \
curl \
openjdk-17-jdk-headless; \
pip install ansible-core ansible-rulebook;
RUN apk update; \
apk add \
build-base \
gcc;
RUN addgroup eda; \
adduser --ingroup eda eda
# COPY extensions/eda/rulebooks/webhook.yaml /eda/
RUN pip install --upgrade \
setuptools \
wheel
RUN ansible-galaxy collection install ansible.eda
# RUN ls -la /home/eda/.ansible/collections/nofusscomputing/git_events/
RUN apk add openjdk21-jdk;
COPY . /home/eda/.ansible/collections/ansible_collections/nofusscomputing/git_events/
RUN pip install --no-cache-dir -r /home/eda/.ansible/collections/ansible_collections/nofusscomputing/git_events/requirements.txt
RUN apk add \
alpine-sdk \
libffi-dev \
maven \
build-base libc-dev;
ENV JAVA_HOME /usr/lib/jvm/java-21-openjdk
# ChatGPT suggestion to fix alpine version >3.19
ENV CFLAGS "-Wno-incompatible-pointer-types"
COPY requirements.txt /tmp/requirements.txt
RUN mkdir -p /tmp/python_modules; \
cd /tmp/python_modules; \
pip download --dest . \
pip \
--check-build-dependencies \
-r /tmp/requirements.txt
RUN cd /tmp/python_modules; \
mkdir -p /tmp/python_builds; \
echo "[DEBUG] PATH=$PATH"; \
ls -l; \
pip wheel --wheel-dir /tmp/python_builds --find-links . *.whl; \
pip wheel --wheel-dir /tmp/python_builds --find-links . *.tar.gz;
FROM python:3.11-alpine3.22
RUN apk --no-cache update; \
apk --no-cache add \
openjdk21-jdk
ENV ANSIBLE_FORCE_COLOR true
ENV ANSIBLE_INVENTORY hosts.yaml
ENV JAVA_HOME /usr/lib/jvm/java-21-openjdk
COPY includes/ /
RUN cp -r /root/.ansible /home/eda/; \
# cp -r /home/eda/.ansible/collections/ansible_collections/nofusscomputing/git_events/includes/* /; \
COPY . /home/eda/.ansible/collections/ansible_collections/nofusscomputing/git_events/
COPY --from=build /tmp/python_builds /tmp/python_builds
RUN pip install --no-cache-dir /tmp/python_builds/*; \
rm -R /tmp/python_builds; \
ansible-galaxy collection install ansible.eda; \
addgroup eda; \
adduser -D --ingroup eda eda; \
cp -r /root/.ansible /home/eda/; \
rm -rf /home/eda/.ansible/collections/ansible_collections/nofusscomputing/git_events/includes; \
mv /usr/bin/annotations.py /usr/bin/annotations; \
chmod +x /usr/bin/annotations; \
chown eda:eda -R /home/eda;
WORKDIR /home/eda
ENV ANSIBLE_INVENTORY hosts.yaml
# required for parser script
USER eda
CMD [ \
"ansible-rulebook", \
"-r", "nofusscomputing.git_events.webhook", \
"--env-vars", "PROBLEM_MATCHER_PORT,PROBLEM_MATCHER_TOKEN", \
"-v" \
]
]

79
galaxy.yml Normal file
View File

@ -0,0 +1,79 @@
---
### REQUIRED
# The namespace of the collection. This can be a company/brand/organization or product namespace under which all
# content lives. May only contain alphanumeric lowercase characters and underscores. Namespaces cannot start with
# underscores or numbers and cannot contain consecutive underscores
namespace: nofusscomputing
# The name of the collection. Has the same character restrictions as 'namespace'
name: git_events
# The version of the collection. Must be compatible with semantic versioning
version: 0.0.1
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md
# A list of the collection's content authors. Can be just the name or in the format 'Full Name <email> (url)
# @nicks:irc/im.site#channel'
authors:
- No Fuss Computing
### OPTIONAL but strongly recommended
# A short summary description of the collection
description: Git[ea/hub] Problem matcher parser with PR Code Review
# Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only
# accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file'
license:
- MIT
# The path to the license file for the collection. This path is relative to the root of the collection. This key is
# mutually exclusive with 'license'
license_file: LICENCE
# A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character
# requirements as 'namespace' and 'name'
tags:
- ci
- event
- rulebook
- tools
# Collections that this collection requires to be installed for it to be usable. The key of the dict is the
# collection label 'namespace.name'. The value is a version range
# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version
# range specifiers can be set and are separated by ','
dependencies: {}
# The URL of the originating SCM repository
repository: https://nofusscomputing.com/git/ansible-collections/git-events
# The URL to any online docs
documentation: https://nofusscomputing.com/git/ansible-collections/git-events
# The URL to the homepage of the collection/project
homepage: https://nofusscomputing.com/git/ansible-collections/git-events
# The URL to the collection issue tracker
issues: https://nofusscomputing.com/git/ansible-collections/git-events/issues
# A list of file glob-like patterns used to filter any files or directories that should not be included in the build
# artifact. A pattern is matched from the relative path of the file or directory of the collection directory. This
# uses 'fnmatch' to match the files or directories. Some directories and files like 'galaxy.yml', '*.pyc', '*.retry',
# and '.git' are always filtered. Mutually exclusive with 'manifest'
build_ignore: [
'.ansible',
artifacts/,
'.git',
'galaxy.yml',
'*.tmp.*'
]
# A dict controlling use of manifest directives used in building the collection artifact. The key 'directives' is a
# list of MANIFEST.in style
# L(directives,https://packaging.python.org/en/latest/guides/using-manifest-in/#manifest-in-commands). The key
# 'omit_default_directives' is a boolean that controls whether the default directives are used. Mutually exclusive
# with 'build_ignore'
# manifest: null

52
meta/runtime.yml Normal file
View File

@ -0,0 +1,52 @@
---
# Collections must specify a minimum required ansible version to upload
# to galaxy
requires_ansible: '>=2.18.0'
# Content that Ansible needs to load from another location or that has
# been deprecated/removed
# plugin_routing:
# action:
# redirected_plugin_name:
# redirect: ns.col.new_location
# deprecated_plugin_name:
# deprecation:
# removal_version: "4.0.0"
# warning_text: |
# See the porting guide on how to update your playbook to
# use ns.col.another_plugin instead.
# removed_plugin_name:
# tombstone:
# removal_version: "2.0.0"
# warning_text: |
# See the porting guide on how to update your playbook to
# use ns.col.another_plugin instead.
# become:
# cache:
# callback:
# cliconf:
# connection:
# doc_fragments:
# filter:
# httpapi:
# inventory:
# lookup:
# module_utils:
# modules:
# netconf:
# shell:
# strategy:
# terminal:
# test:
# vars:
# Python import statements that Ansible needs to load from another location
# import_redirection:
# ansible_collections.ns.col.plugins.module_utils.old_location:
# redirect: ansible_collections.ns.col.plugins.module_utils.new_location
# Groups of actions/modules that take a common set of options
# action_groups:
# group_name:
# - module1
# - module2

View File

@ -57,7 +57,7 @@
cat /tmp/job.log | annotations > /tmp/annotations.json;
executable: bash
executable: sh
changed_when: false

5
requirements.txt Normal file
View File

@ -0,0 +1,5 @@
ansible-core==2.18.6
ansible-rulebook==1.1.7
requests