Commit ded1b01b authored by vertighel's avatar vertighel
Browse files
parents 00ae5025 984fc4f2
Loading
Loading
Loading
Loading
Loading
+29 −12
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ variables:
  PYLINT_TARGETS: "noctua" # For pylint
  GIT_USER_EMAIL: "davide.ricci@inaf.it"
  GIT_USER_NAME: "Davide GitLab CI"
  FORMATTED_BRANCH_NAME: "ci-auto-formatted"
  FORMATTED_BRANCH_NAME: "validated"

cache:
  key: "$CI_COMMIT_REF_SLUG" # Cache pip downloads per branch
@@ -19,7 +19,7 @@ cache:
stages:
  - setup_and_format 
  - lint # A stage for checks that don't modify code (like pylint)
 # - auto_commit 
  - auto_commit 

# Job 1: Install Noctua and its dependencies
install_noctua:
@@ -113,7 +113,7 @@ run_pylint:
    - echo "Current directory $(pwd)"
    - echo "Running pylint on '${PYLINT_TARGETS}'..."
    - pylint --version     
  #  - pylint --rcfile=.pylintrc "${PYLINT_TARGETS}"
    - pylint --rcfile=.pylintrc --fail-on=E,F ${PYLINT_TARGETS}/sequencer.py || echo "Pylint finished with exit code $(( $? &2)) (non-zero indicates issues)"
    - echo "Pylint check complete."
  #rules:
  #  - if: $CI_PIPELINE_SOURCE == "merge_request_event"
@@ -121,14 +121,31 @@ run_pylint:
  #  - when: manual
  #    allow_failure: true # Allow manual trigger to not fail overall pipeline if desired

#commit_formatted_code:
#   stage: auto_commit
#   tags:
#     - git-run-ia2
#   needs:
##     - job: run_pylint # Must pass pylint
#     - job: apply_autopep8 # Needs the final code state from formatting
#       artifacts: true
commit_formatted_code:
  stage: auto_commit
  tags:
    - git-run-ia2
  needs:
    - job: run_pylint # Must pass pylint
    - job: apply_autopep8 # Needs the final code state from formatting
      artifacts: true
  script:                                                                                
    - echo "Pushing on validated branch..."                                              
  after_script:                                                                          
    - git config --global user.email "davide.ricci@inaf.it"                              
    - git config --global user.name "CI Bot"                                             
    - git checkout -b validated                                                          
    - git add .                                                                          
    - MAIN_COMMIT_MSG=$(git log -1 --pretty=%B $CI_COMMIT_SHA)                           
    - |                                                                                  
      git commit -m "$MAIN_COMMIT_MSG                                                    
        - Source Commit: $CI_COMMIT_SHA                                                  
        - Date: $(date +"%Y-%m-%d %H:%M:%S")                                             
        - Job ID: $CI_JOB_ID                                                             
        - Pipeline ID: $CI_PIPELINE_ID"                                                  
    - git pull                                                                           
    - git push https://davide.ricci:$GITLAB_TOKEN@www.ict.inaf.it/gitlab/davide.ricci/software-di-controllo.git $(FORMATTED_BRANCH_NAME)                                                         

#   before_script:
#     # Git and SSH setup (ensure SSH_DEPLOY_KEY CI/CD variable is set as File type)
#     - apt-get update -y && apt-get install -y openssh-client git