From 6ac53d92fe55b90eda5d55c0efc44b433b60652d Mon Sep 17 00:00:00 2001
From: fejao <mail@fejao.de>
Date: Wed, 12 Feb 2025 14:13:12 +0100
Subject: [PATCH] setting ci-cd

---
 .gitlab-ci.yml                | 52 +++++++++++++++++++++++++++++++++++
 ci-cd/python_requirements.txt |  4 +++
 2 files changed, 56 insertions(+)
 create mode 100644 .gitlab-ci.yml
 create mode 100644 ci-cd/python_requirements.txt

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..3a124d9
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,52 @@
+---
+
+###
+### VARIABLES
+###
+variables:
+  AUTHOR: fejao
+  IMAGE_NAME_LINT: python:3.10.15-bullseye
+  # PATH_ENV_DIR: "/builds/fejao/c3infodesk-deployment-role-test"
+  PATH_ENV_DIR: "/builds/fejao/c3infodesk-deployment-role-dependencies"
+  PATH_PYTHON_REQ_FILE: "/builds/fejao/c3infodesk-deployment-role-test/ci-cd/python_requirements.txt"
+  PATH_PLAYBOOK: "/builds/fejao/c3infodesk-deployment-role-test/ci-cd/playbook_role_test.yml"
+
+###
+### STAGES
+###
+stages:
+  - yamllint
+  - upstream-trigger
+
+###
+### SCRIPTS
+###
+.install_dependencies: &install_dependencies
+  # Install python and it's requirements
+  - apt-get update && apt-get install -y python3-pip && apt-get clean && rm -rf /var/lib/apt/lists/*
+  - pip3 install -r $PYTHON_REQ_FILE_PATH
+  ### Correct the permissions on the build environment directory.
+  ### See https://github.com/ansible/ansible/pull/42142/files
+  - chmod 700 $PATH_ENV_DIR
+
+yamllint-test:
+  stage: yamllint
+  image: $IMAGE_NAME_LINT
+  variables:
+    PYTHON_REQ_FILE_PATH: $PATH_PYTHON_REQ_FILE
+    PLAYBOOK_PATH: $PATH_PLAYBOOK
+  before_script:
+    - *install_dependencies
+  script:
+    - echo "This is the 'yamllint' test from the 'test' role"
+    - yamllint .
+
+# trigger-pipeline:
+#   stage: upstream-trigger
+#   variables:
+#     # RUN_UPSTREAM_FOR_ROLE_TEST: true
+#     RUN_UPSTREAM_FOR_ROLE_DEPENDENCIES: true
+#   trigger:
+#     project: fejao/c3infodesk-deployment
+#     branch: main
+#     strategy: depend
diff --git a/ci-cd/python_requirements.txt b/ci-cd/python_requirements.txt
new file mode 100644
index 0000000..a1dff81
--- /dev/null
+++ b/ci-cd/python_requirements.txt
@@ -0,0 +1,4 @@
+yamllint
+ansible
+ansible-dev-tools
+ansible-lint
-- 
GitLab