-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
36 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,28 @@ | ||
name: Build and deploy on dev | ||
|
||
|
||
on: | ||
push: | ||
branches: | ||
- '**' # matches every branch | ||
- '!main' # excludes main | ||
on: [push] | ||
|
||
env: | ||
CI_COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | ||
|
||
jobs: | ||
build: | ||
test_job: | ||
runs-on: ubuntu-latest | ||
name: Test job | ||
steps: | ||
- name: checkout repo content | ||
uses: actions/checkout@v4 # checkout the repository content | ||
|
||
- name: setup python | ||
uses: actions/setup-python@v4 | ||
- name: Ci with saagie tool | ||
id: update | ||
uses: saagie/[email protected] | ||
with: | ||
python-version: '3.10' # install the python version needed | ||
|
||
- name: install required python librairies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r cicd_saagie_tool/requirements.txt | ||
- name: Get specific changed files | ||
id: changed-files-specific | ||
uses: tj-actions/changed-files@v37 # check if we have file changed | ||
with: | ||
files_yaml: | | ||
jobs: | ||
- saagie/jobs/*.json | ||
pipelines: | ||
- saagie/pipelines/*.json | ||
- name: Run step if any of the jobs files above change | ||
if: steps.changed-files-specific.outputs.jobs_any_changed == 'true' # check if a job config file have change | ||
# then it will package the job and update on Saagie | ||
run: | | ||
for file in ${{ steps.changed-files-specific.outputs.jobs_all_changed_files }}; do | ||
echo "$file was modified" | ||
file_name=$(basename ${file}) | ||
file_name_without_ext=${file_name%.*} | ||
python cicd_saagie_tool/__main__.py --action package_job --job_name ${file_name_without_ext} | ||
python cicd_saagie_tool/__main__.py --action update_job --job_name ${file_name_without_ext} --saagie_url "${{secrets.SAAGIE_URL}}" --saagie_user "${{secrets.SAAGIE_USER}}" --saagie_pwd "${{secrets.SAAGIE_PWD}}" --saagie_realm "${{secrets.SAAGIE_REALM}}}" --saagie_env dev | ||
done | ||
- name: Run step if any of the pipelines files above change | ||
if: steps.changed-files-specific.outputs.pipelines_any_changed == 'true' # check if a pipeline config file have change | ||
# then it will update on Saagie | ||
run: | | ||
for file in ${{ steps.changed-files-specific.outputs.pipelines_all_changed_files }}; do | ||
echo "$file was modified" | ||
file_name=$(basename ${file}) | ||
file_name_without_ext=${file_name%.*} | ||
python cicd_saagie_tool/__main__.py --action update_pipeline --pipeline_name ${file_name_without_ext} --saagie_url "${{secrets.SAAGIE_URL}}" --saagie_user "${{secrets.SAAGIE_USER}}" --saagie_pwd "${{secrets.SAAGIE_PWD}}" --saagie_realm "${{secrets.SAAGIE_REALM}}" --saagie_env dev | ||
done | ||
saagie_url: ${{secrets.SAAGIE_URL}} | ||
saagie_user: ${{secrets.SAAGIE_USER}} | ||
saagie_pwd: ${{secrets.SAAGIE_PWD}} | ||
saagie_realm: ${{secrets.SAAGIE_REALM}} | ||
saagie_env: 'dev' | ||
job_config_folder: './saagie/jobs/*.json' | ||
pipeline_config_folder: './saagie/pipelines/*.json' | ||
env_config_folder: './saagie/envs/*.json' | ||
job_source_folder: './code/jobs/*/*' | ||
pipeline_source_folder: './code/pipelines/*.yaml' | ||
artefact_code_folder: './dist/*/*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,31 @@ | ||
name: Build and deploy on prod | ||
|
||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' # matches only main | ||
- 'main' | ||
|
||
env: | ||
CI_COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | ||
|
||
jobs: | ||
build: | ||
test_job: | ||
runs-on: ubuntu-latest | ||
name: Test job of Saagie CI/CD tool | ||
steps: | ||
- name: checkout repo content | ||
uses: actions/checkout@v4 # checkout the repository content | ||
|
||
- name: setup python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' # install the python version needed | ||
|
||
- name: install required python librairies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r cicd_saagie_tool/requirements.txt | ||
- name: Get specific changed files | ||
id: changed-files-specific | ||
uses: tj-actions/changed-files@v37 # check if we have file changed | ||
- name: Ci with saagie tool | ||
id: update | ||
uses: saagie/[email protected] | ||
with: | ||
files_yaml: | | ||
jobs: | ||
- saagie/jobs/*.json | ||
pipelines: | ||
- saagie/pipelines/*.json | ||
- name: Run step if any of the jobs files above change | ||
if: steps.changed-files-specific.outputs.jobs_any_changed == 'true' # check if a job config file have change | ||
# then it will package the job and update on Saagie | ||
run: | | ||
for file in ${{ steps.changed-files-specific.outputs.jobs_all_changed_files }}; do | ||
echo "$file was modified" | ||
file_name=$(basename ${file}) | ||
file_name_without_ext=${file_name%.*} | ||
python cicd_saagie_tool/__main__.py --action package_job --job_name ${file_name_without_ext} | ||
python cicd_saagie_tool/__main__.py --action update_job --job_name ${file_name_without_ext} --saagie_url "${{secrets.SAAGIE_URL}}" --saagie_user "${{secrets.SAAGIE_USER}}" --saagie_pwd "${{secrets.SAAGIE_PWD}}" --saagie_realm "${{secrets.SAAGIE_REALM}}}" --saagie_env prod | ||
done | ||
- name: Run step if any of the pipelines files above change | ||
if: steps.changed-files-specific.outputs.pipelines_any_changed == 'true' # check if a pipeline config file have change | ||
# then it will update on Saagie | ||
run: | | ||
for file in ${{ steps.changed-files-specific.outputs.pipelines_all_changed_files }}; do | ||
echo "$file was modified" | ||
file_name=$(basename ${file}) | ||
file_name_without_ext=${file_name%.*} | ||
python cicd_saagie_tool/__main__.py --action update_pipeline --pipeline_name ${file_name_without_ext} --saagie_url "${{secrets.SAAGIE_URL}}" --saagie_user "${{secrets.SAAGIE_USER}}" --saagie_pwd "${{secrets.SAAGIE_PWD}}" --saagie_realm "${{secrets.SAAGIE_REALM}}" --saagie_env prod | ||
done | ||
saagie_url: ${{secrets.SAAGIE_URL}} | ||
saagie_user: ${{secrets.SAAGIE_USER}} | ||
saagie_pwd: ${{secrets.SAAGIE_PWD}} | ||
saagie_realm: ${{secrets.SAAGIE_REALM}} | ||
saagie_env: 'prod' | ||
job_config_folder: './saagie/jobs/*.json' | ||
pipeline_config_folder: './saagie/pipelines/*.json' | ||
env_config_folder: './saagie/envs/*.json' | ||
job_source_folder: './code/jobs/*/*' | ||
pipeline_source_folder: './code/pipelines/*.yaml' | ||
artefact_code_folder: './dist/*/*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters