stages: - deploy_stage - failed_stage image: alpine:latest # Use the latest version of Alpine Linux docker image deploy_job: stage: deploy_stage before_script: - 'which ssh-agent || (apk update && apk add curl openssh-client git grep sed)' script: - sh script.sh - git checkout master - git config --global user.name "curben-bot" - git config --global user.email "3048979-curben-bot@users.noreply.gitlab.com" # Commit the changes - sh utils/commit.sh after_script: - eval $(ssh-agent -s) - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null - echo "$GH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null - mkdir -p ~/.ssh - chmod 700 ~/.ssh - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts - git checkout master - git config --global user.name "curben-bot" - git config --global user.email "3048979-curben-bot@users.noreply.gitlab.com" # Generate successful status badge - mkdir -p .gitlab/ - sh utils/badge.sh "success" - git add .gitlab/status.svg # Only commit when diff exists https://stackoverflow.com/a/8123841 - git diff-index --quiet HEAD || git commit -m "Success pipeline" - ssh -T git@gitlab.com - git remote set-url origin git@gitlab.com:curben/urlhaus-filter.git - git push origin master # Push to mirror # Force exit code 0 - ssh -T git@github.com || ":" - git remote add mirror git@github.com:curbengh/urlhaus-filter.git - git push mirror master only: # Allow CI to be triggered by schedule - schedules # Allow CI to be triggered manually - web failed_job: stage: failed_stage before_script: - 'which ssh-agent || (apk update && apk add curl openssh-client git grep sed)' - eval $(ssh-agent -s) - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null - echo "$GH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null - mkdir -p ~/.ssh - chmod 700 ~/.ssh - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts script: - git checkout master - git config --global user.name "curben-bot" - git config --global user.email "3048979-curben-bot@users.noreply.gitlab.com" - mkdir -p .gitlab/ - sh utils/badge.sh "failed" - git add .gitlab/status.svg - git diff-index --quiet HEAD || git commit -m "Failed pipeline" - ssh -T git@gitlab.com - git remote set-url origin git@gitlab.com:curben/urlhaus-filter.git - git push origin master - ssh -T git@github.com || ":" - git remote add mirror git@github.com:curbengh/urlhaus-filter.git - git push mirror master # Run this job only when deploy_job failed when: on_failure only: - schedules - web