diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2852d4abd613c79dd8775bb5d9ef67f0cc6ac307..170b1c5c10c9d8150b3e28501498215485d9faf5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,18 +5,59 @@ stages: - build - test - deploy + - update-from-upstream services: - docker:20.10-dind +searx: + stage: update-from-upstream + image: registry.gitlab.e.foundation/e/tools/docker-tools:latest + only: + - schedules + variables: + GIT_STRATEGY: none + CI_PROJECT_SSH_URL: git@gitlab.e.foundation:$CI_PROJECT_PATH + before_script: + - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' + - eval $(ssh-agent -s) + - echo "${SSH_E_ROBOT_PRIVATE_KEY}" | tr -d '\r' | ssh-add - > /dev/null + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - echo "${SSH_KNOWN_HOSTS}" > /root/.ssh/known_hosts + - chmod 644 ~/.ssh/known_hosts + - git config --global user.email $GITLAB_USER_EMAIL + - git config --global user.name "$GITLAB_USER_NAME" + - cd $CI_BUILD_DIR + - rm -rf $CI_PROJECT_DIR + - git clone $CI_PROJECT_SSH_URL $CI_PROJECT_DIR + - cd $CI_PROJECT_DIR + script: + - git fetch origin + - git checkout $CI_COMMIT_REF_NAME + - git remote add upstream $UPSTREAM_REPO + - git pull upstream/$UPSTREAM_BRANCH + - git merge upstream/$UPSTREAM_BRANCH + - git push + python: stage: check + only: + - tags + - branches + except: + - schedules script: - ./manage test.pep8 - ./manage test.pylint build:web: stage: build + only: + - tags + - branches + except: + - schedules before_script: - ./manage node.update - ./manage node.env @@ -40,6 +81,11 @@ build:web: - docker push $CI_REGISTRY_IMAGE/nginx:$CI_COMMIT_REF_SLUG build:docker: + only: + - tags + - branches + except: + - schedules extends: .build:docker build:docker:tags: @@ -56,6 +102,11 @@ build:docker:tags: test:unit: stage: test + only: + - tags + - branches + except: + - schedules script: - ./manage test.coverage coverage: '/TOTAL.*\s+(\d+%)$/' @@ -79,6 +130,8 @@ deploy:spot.eeo.one.backend1: when: manual only: - branches + except: + - schedules environment: name: eeo1 url: https://spot.eeo.one @@ -122,6 +175,8 @@ deploy:spot.eeo.one.backend2: when: manual only: - branches + except: + - schedules environment: name: eeo2 url: https://spot.eeo.one