2024-02-28 21:53:17 -05:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: Lint on PR
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- pull_request
|
|
|
|
|
|
|
|
steps:
|
2024-02-28 22:26:29 -05:00
|
|
|
- name: python3.8
|
2024-02-28 21:53:17 -05:00
|
|
|
image: python:3.8-slim-bullseye
|
|
|
|
commands:
|
2024-02-28 22:26:29 -05:00
|
|
|
- "python3 --version"
|
2024-02-28 21:53:17 -05:00
|
|
|
- "pip3 install yamllint"
|
|
|
|
- "yamllint --version"
|
2024-02-29 04:17:49 -05:00
|
|
|
- 'find . -name "*.yml" ! -name ".drone.yml" -exec yamllint -d "{extends: relaxed, rules: {line-length: {max: 120}}}" {} +'
|
|
|
|
- 'find . -name "*.yaml" ! -name ".drone.yml" -exec yamllint -d "{extends: relaxed, rules: {line-length: {max: 120}}}" {} +'
|
2024-02-28 21:53:17 -05:00
|
|
|
|
|
|
|
- name: python3.9
|
|
|
|
image: python:3.9-slim-bullseye
|
|
|
|
commands:
|
|
|
|
- "python3 --version"
|
|
|
|
- "pip3 install yamllint"
|
|
|
|
- "yamllint --version"
|
2024-02-29 04:17:49 -05:00
|
|
|
- 'find . -name "*.yml" ! -name ".drone.yml" -exec yamllint -d "{extends: relaxed, rules: {line-length: {max: 120}}}" {} +'
|
|
|
|
- 'find . -name "*.yaml" ! -name ".drone.yml" -exec yamllint -d "{extends: relaxed, rules: {line-length: {max: 120}}}" {} +'
|
2024-02-28 21:53:17 -05:00
|
|
|
|
|
|
|
- name: python3.10
|
|
|
|
image: python:3.10-slim-bullseye
|
|
|
|
commands:
|
|
|
|
- "python3 --version"
|
|
|
|
- "pip3 install yamllint"
|
|
|
|
- "yamllint --version"
|
2024-02-29 04:17:49 -05:00
|
|
|
- 'find . -name "*.yml" ! -name ".drone.yml" -exec yamllint -d "{extends: relaxed, rules: {line-length: {max: 120}}}" {} +'
|
|
|
|
- 'find . -name "*.yaml" ! -name ".drone.yml" -exec yamllint -d "{extends: relaxed, rules: {line-length: {max: 120}}}" {} +'
|
2024-02-29 04:41:23 -05:00
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
kind: pipeline
|
|
|
|
type: gitea
|
|
|
|
|
|
|
|
name: update-branch-on-push
|
|
|
|
|
|
|
|
# This triggers the pipeline only when there's a push to the "main" branch.
|
|
|
|
trigger:
|
|
|
|
branch:
|
|
|
|
- main
|
|
|
|
|
|
|
|
# Define steps for the pipeline
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
git:
|
|
|
|
depth: 1
|
|
|
|
|
|
|
|
# Find subfolders with docker-compose.yml files
|
|
|
|
- name: Find folders to update
|
|
|
|
script: |
|
|
|
|
folders=$(find . -type d -name 'docker-compose.yml' | sed 's/\/docker-compose\.yml//g' | uniq)
|
2024-02-29 04:43:02 -05:00
|
|
|
echo "Found folders: $folders"
|
2024-02-29 04:41:23 -05:00
|
|
|
|
|
|
|
# Loop through each folder and update its branch
|
|
|
|
- name: Update branches
|
|
|
|
template: |
|
|
|
|
{{ range $folder := $folders }}
|
|
|
|
- name: Update {{ $folder }} branch
|
|
|
|
commands:
|
|
|
|
- git fetch origin {{ $folder }}
|
|
|
|
- git checkout {{ $folder }}
|
|
|
|
- git rebase origin/main
|
|
|
|
- git push origin {{ $folder }}
|
2024-02-29 04:43:02 -05:00
|
|
|
{{ end }}
|
2024-02-29 04:41:23 -05:00
|
|
|
|
|
|
|
# This condition ensures the pipeline runs only if there are changes to any folder
|
|
|
|
when:
|
|
|
|
- expression: |
|
2024-02-29 04:43:02 -05:00
|
|
|
git diff --name-only origin/main HEAD | grep -E '\.(yml|yaml)'
|