Commit 2d3df923 authored by Davide Ricci's avatar Davide Ricci
Browse files

Update .gitlab-ci.yml file

parent dd70c880
Loading
Loading
Loading
Loading
Loading
+26 −9
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
@@ -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