Skip to content

Commit f7e0336

Browse files
committed
Initial commit
0 parents  commit f7e0336

File tree

680 files changed

+145909
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

680 files changed

+145909
-0
lines changed

.gitignore

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
__pycache__/
2+
scripts/
3+
*.DS_Store
4+
.rsync-exclude.txt
5+
.ipynb_checkpoints
6+
*.egg-info
7+
*.pyc
8+
build/
9+
dist/
10+
.tox/
11+
licenses_example/choosealicense.com
12+
.idea/
13+
*.iml
14+
.gradle/
15+
venv/
16+
.venv-*
17+
lib64/
18+
bin/
19+
activate
20+
**/mypy-precision/
21+
**/.coverage
22+
*.log
23+
.ipynb
24+
.vscode/
25+
*.code-workspace
26+
**/venv-*/*
27+
28+
# VSCode extensions
29+
npm-debug.log
30+
Thumbs.db
31+
**/node_modules/
32+
**/out/
33+
**/.vs/
34+
tsconfig.lsif.json
35+
*.lsif
36+
*.db
37+
*.vsix
38+
39+
# Dependency directories
40+
node_modules
41+
jspm_packages
42+
43+
# User-specific stuff:
44+
.idea
45+
46+
# Gradle:
47+
.gradle
48+
build
49+
50+
# IntelliJ
51+
/out/
52+
*/**/out/
53+
54+
# OS generated files #
55+
.DS_Store
56+
.DS_Store?
57+
._*
58+
.Spotlight-V100
59+
.Trashes
60+
ehthumbs.db
61+
Thumbs.db
62+
63+
*.py[cod]
64+
*$py.class
65+
bin/
66+
*.cfg
67+
!wayflowcore/setup.cfg
68+
cx_Oracle*
69+
# C extensions
70+
*.so
71+
72+
# Distribution / packaging
73+
.Python
74+
build/
75+
/lcnc/
76+
develop-eggs/
77+
dist/
78+
downloads/
79+
eggs/
80+
.eggs/
81+
lib/
82+
lib64/
83+
parts/
84+
sdist/
85+
var/
86+
wheels/
87+
share/python-wheels/
88+
*.egg-info/
89+
.installed.cfg
90+
*.egg
91+
MANIFEST
92+
93+
# PyInstaller
94+
# Usually these files are written by a python script from a template
95+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
96+
*.manifest
97+
*.spec
98+
99+
# Installer logs
100+
pip-log.txt
101+
pip-delete-this-directory.txt
102+
103+
# Unit test / coverage reports
104+
htmlcov/
105+
.tox/
106+
.nox/
107+
.coverage
108+
.coverage.*
109+
.cache
110+
nosetests.xml
111+
coverage.xml
112+
*.cover
113+
*.py,cover
114+
.hypothesis/
115+
.pytest_cache/
116+
cover/
117+
118+
# Translations
119+
*.mo
120+
*.pot
121+
122+
# Django stuff:
123+
*.log
124+
local_settings.py
125+
db.sqlite3
126+
db.sqlite3-journal
127+
128+
# Flask stuff:
129+
instance/
130+
.webassets-cache
131+
132+
# Scrapy stuff:
133+
.scrapy
134+
135+
# Sphinx documentation
136+
docs/wayflowcore/build/
137+
138+
# PyBuilder
139+
.pybuilder/
140+
target/
141+
142+
# Jupyter Notebook
143+
.ipynb_checkpoints
144+
145+
# IPython
146+
profile_default/
147+
ipython_config.py
148+
149+
# pyenv
150+
# For a library or package, you might want to ignore these files since the code is
151+
# intended to run in multiple environments; otherwise, check them in:
152+
# .python-version
153+
154+
# pipenv
155+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
156+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
157+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
158+
# install all needed dependencies.
159+
#Pipfile.lock
160+
161+
# poetry
162+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
163+
# This is especially recommended for binary packages to ensure reproducibility, and is more
164+
# commonly ignored for libraries.
165+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
166+
#poetry.lock
167+
168+
# pdm
169+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
170+
#pdm.lock
171+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
172+
# in version control.
173+
# https://pdm.fming.dev/#use-with-ide
174+
.pdm.toml
175+
176+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
177+
__pypackages__/
178+
179+
# Celery stuff
180+
celerybeat-schedule
181+
celerybeat.pid
182+
183+
# mypy
184+
.mypy_cache/
185+
.dmypy.json
186+
dmypy.json
187+
188+
# Pyre type checker
189+
.pyre/
190+
191+
# pytype static type analyzer
192+
.pytype/
193+
194+
# Cython debug symbols
195+
cython_debug/
196+
197+
# User-specific stuff:
198+
.idea
199+
.DS_Store
200+
Thumbs.db
201+
202+
*.pklz
203+
*.sqlite

.gitlab-ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
image : $GITLAB_CI_CD_IMAGE
2+
include:
3+
- local: '.gitlab/jobs/templates/get_private_branch.yml'
4+
- local: '.gitlab/jobs/templates/get_merge_request_id.yml'
5+
- local: '.gitlab/jobs/schedule_mergegate.yml'
6+
- local: '.gitlab/jobs/schedule_regression.yml'
7+
8+
stages:
9+
- trigger

.gitlab/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## [1.0.0] - 2025-07-15
4+
### Added
5+
- Initial version of the GitLab CI Integration.

.gitlab/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# GitLab CI Integration
2+
3+
## Overview
4+
5+
This folder contains Giltab CI/CD configurations and supporting files. It contains jobs that are designed to interface with Jenkins, allowing manual trigger jobs to initiate Jenkins pipelines from within Gitlab. The folder includes:
6+
- GitLab CI manual jobs
7+
8+
Currently, we support three key pipelines:
9+
- **Regression Pipeline** – for running regression tests
10+
11+
Each job is a scheduler that initiates a corresponding Jenkins pipeline.
12+
13+
## Getting Started
14+
15+
This guide helps you understand the structure, setup, and usage of the GitLab CI integration with Jenkins.
16+
17+
## Prerequisites
18+
19+
- Access to the Gitlab repository hosted in **Gitlab**
20+
- Jenkins access token to trigger pipelines
21+
- Gitlab project access token
22+
- Proper configuration in the Jenkins job to accept remote triggers
23+
24+
## Configuration
25+
26+
1. update the `.gitlab/jobs` folder to add your jobs and update `.gitlab-ci.yml` file to include or reference manual jobs you added.
27+
2. Ensure Jenkins is configured to accept remote builds via token or webhook.
28+
3. Link Jenkins job names and parameters in the GitLab job scripts as needed.
29+
4. Add required environment variables in GitLab CI/CD settings (e.g., `GITLAB_MERGE_BOT_TOKEN`, `JENKINS_BOT_AUTH`).
30+
31+
## How to Use the Jobs
32+
33+
### Regression Pipeline
34+
35+
This pipeline is triggered manually ,and it's responsibility is to trigger the regression pipeline in jenkins.
36+
37+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
schedule_mergegate:
2+
stage: trigger
3+
when: manual
4+
variables:
5+
DELETE_BRANCH:
6+
value: "false"
7+
script:
8+
- !reference [ .get_merge_request_id, script ]
9+
- !reference [ .get_private_branch, script ]
10+
- |
11+
curl -X POST "${JENKINS_URL}/job/Regression/job/mergegate/buildWithParameters" \
12+
--user "$JENKINS_BOT_AUTH" \
13+
--data-urlencode "BRANCH=$PRIVATE_BRANCH" \
14+
--data-urlencode "PUBLIC_BRANCH=$CI_COMMIT_REF_NAME" \
15+
--data-urlencode "EMAIL=$GITLAB_USER_EMAIL" \
16+
--data-urlencode "PUBLIC_PRID=$PUBLIC_MERGE_REQUEST_ID" \
17+
--data-urlencode "PRIVATE_PRID=$PRIVATE_MERGE_REQUEST_ID" \
18+
--data-urlencode "COMMIT=$PRIVATE_MERGE_REQUEST_COMMIT_HASH" \
19+
--data-urlencode "PUBLIC_COMMIT=$CI_COMMIT_SHA" \
20+
--data-urlencode "PR_SOURCE_PROJECT=$CI_PROJECT_NAMESPACE" \
21+
--data-urlencode "PR_SOURCE_REPOSITORY=$CI_PROJECT_NAME" \
22+
--data-urlencode "PR_SOURCE_ID=$PUBLIC_MERGE_REQUEST_ID" \
23+
--data-urlencode "USE_${REPOSITORY_HOST}=true" \
24+
--data-urlencode "DELETE_BRANCH=$DELETE_BRANCH" \
25+
--data-urlencode "${REPOSITORY_HOST}_PIPELINE_ID=$CI_PIPELINE_ID"
26+
- echo "waiting for external pipeline to appear on gitlab UI"
27+
- sleep 50
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
schedule_regression:
2+
stage: trigger
3+
when: manual
4+
variables:
5+
llmCodeGenSubmodule:
6+
value: "all"
7+
dryRunSubmodule:
8+
value: "same"
9+
script:
10+
- !reference [ .get_private_branch, script ]
11+
- |
12+
curl -X POST "${JENKINS_URL}/job/Regression/job/regression/buildWithParameters" \
13+
--user "$JENKINS_BOT_AUTH" \
14+
--data-urlencode "BRANCH=$PRIVATE_BRANCH" \
15+
--data-urlencode "PUBLIC_BRANCH=$CI_COMMIT_REF_NAME" \
16+
--data-urlencode "PUBLIC_COMMIT=$CI_COMMIT_SHA" \
17+
--data-urlencode "PR_SOURCE_PROJECT=$CI_PROJECT_NAMESPACE" \
18+
--data-urlencode "PR_SOURCE_REPOSITORY=$CI_PROJECT_NAME" \
19+
--data-urlencode "EMAIL=$GITLAB_USER_EMAIL" \
20+
--data-urlencode "llmCodeGenSubmodule=$llmCodeGenSubmodule" \
21+
--data-urlencode "USE_${REPOSITORY_HOST}=true" \
22+
--data-urlencode "${REPOSITORY_HOST}_PIPELINE_ID=$CI_PIPELINE_ID"
23+
- sleep 50
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
.get_merge_request_id:
2+
script:
3+
- |
4+
#!/bin/bash
5+
6+
# Encode the branch name
7+
ENCODED_BRANCH_NAME=$(echo -n "${CI_COMMIT_REF_NAME}" | sed 's|/|%2F|g')
8+
API_URL="$GITLAB_URL/projects/$CI_PROJECT_ID"
9+
10+
echo "Checking merge requests for branch: '${CI_COMMIT_REF_NAME}'"
11+
12+
# Temporary file for HTTP response
13+
HTTP_RESPONSE=$(mktemp)
14+
15+
# Make API call and capture response + HTTP code
16+
HTTP_STATUS=$(curl -s -o "$HTTP_RESPONSE" -w "%{http_code}" \
17+
--header "PRIVATE-TOKEN: $GITLAB_BOT_TOKEN" \
18+
"${API_URL}/merge_requests?state=opened&source_branch=$ENCODED_BRANCH_NAME")
19+
20+
if [ "$HTTP_STATUS" -ne 200 ]; then
21+
echo "Error: Received HTTP status $HTTP_STATUS when fetching merge requests. Exiting."
22+
cat "$HTTP_RESPONSE"
23+
rm "$HTTP_RESPONSE"
24+
exit 1
25+
fi
26+
27+
RESPONSE=$(cat "$HTTP_RESPONSE")
28+
rm "$HTTP_RESPONSE"
29+
30+
# Count merge requests by counting occurrences of "iid"
31+
MR_COUNT=$(echo "$RESPONSE" | grep -o '"iid":' | wc -l)
32+
33+
if [ "$MR_COUNT" -eq 0 ]; then
34+
echo "No merge requests found for branch '${CI_COMMIT_REF_NAME}'."
35+
exit 1
36+
elif [ "$MR_COUNT" -gt 1 ]; then
37+
echo "Error: More than one merge request ($MR_COUNT) is open for branch '${CI_COMMIT_REF_NAME}' in $CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME."
38+
exit 1
39+
else
40+
echo "One merge request found for branch '${CI_COMMIT_REF_NAME}'."
41+
MR_ID=$(echo "$RESPONSE" | grep -o '"iid":[0-9]*' | head -n1 | cut -d ':' -f2)
42+
export PUBLIC_MERGE_REQUEST_ID="$MR_ID"
43+
echo "PUBLIC_MERGE_REQUEST_ID='$PUBLIC_MERGE_REQUEST_ID'"
44+
fi

0 commit comments

Comments
 (0)