chore: remove git clone step
This commit is contained in:
parent
05b17109d5
commit
37bc5a5c38
|
@ -1,7 +1,6 @@
|
|||
stages:
|
||||
- deploy_stage
|
||||
- failed_stage
|
||||
- pages_stage
|
||||
|
||||
image: alpine:latest # Use the latest version of Alpine Linux docker image
|
||||
|
||||
|
@ -9,46 +8,18 @@ deploy_job:
|
|||
stage: deploy_stage
|
||||
|
||||
before_script:
|
||||
# Install dependencies
|
||||
- 'which ssh-agent || ( apk update && apk add openssh-client git grep)'
|
||||
|
||||
# Run ssh-agent
|
||||
- eval $(ssh-agent -s)
|
||||
|
||||
# Import private key with ed25519 workaround
|
||||
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
|
||||
- echo "$GH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
|
||||
|
||||
# Create the SSH directory and give it the right permissions
|
||||
- mkdir -p ~/.ssh
|
||||
- chmod 700 ~/.ssh
|
||||
|
||||
# Add gitlab.com as ssh known host
|
||||
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
|
||||
- chmod 644 ~/.ssh/known_hosts
|
||||
|
||||
# Set commit author
|
||||
- git config --global user.name "curben-bot"
|
||||
- git config --global user.email "curben-bot@users.noreply.gitlab.com"
|
||||
|
||||
# SSH to gitlab.com
|
||||
- ssh git@gitlab.com
|
||||
|
||||
# Shallow cloning for faster cloning
|
||||
- git clone --depth 3 git@gitlab.com:curben/urlhaus-filter.git build
|
||||
- cd build/
|
||||
- 'which ssh-agent || (apk update && apk add openssh-client git grep)'
|
||||
|
||||
script:
|
||||
# Run scripts
|
||||
- sh script.sh
|
||||
|
||||
- git config --global user.name "curben-bot"
|
||||
- git config --global user.email "curben-bot@users.noreply.gitlab.com"
|
||||
|
||||
# Commit the changes
|
||||
- sh utils/commit.sh
|
||||
|
||||
after_script:
|
||||
- cd build/
|
||||
|
||||
# Re-add ssh key https://gitlab.com/gitlab-org/gitlab-runner/issues/1926
|
||||
- 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
|
||||
|
@ -62,11 +33,10 @@ deploy_job:
|
|||
- wget https://img.shields.io/badge/pipeline-passed-success.svg -O .gitlab/status.svg
|
||||
- git add .gitlab/status.svg
|
||||
# Only commit when diff exists https://stackoverflow.com/a/8123841
|
||||
- git config --global user.name "curben-bot"
|
||||
- git config --global user.email "curben-bot@users.noreply.gitlab.com"
|
||||
- git diff-index --quiet HEAD || git commit -m "Success pipeline"
|
||||
|
||||
- ssh git@gitlab.com
|
||||
- ssh -T git@gitlab.com
|
||||
- git remote set-url origin git@gitlab.com:curben/urlhaus-filter.git
|
||||
- git push origin master
|
||||
|
||||
# Push to mirror
|
||||
|
@ -85,8 +55,8 @@ deploy_job:
|
|||
failed_job:
|
||||
stage: failed_stage
|
||||
|
||||
script:
|
||||
- cd build/
|
||||
before_script:
|
||||
- 'which ssh-agent || (apk update && apk add openssh-client git grep)'
|
||||
- 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
|
||||
|
@ -94,13 +64,14 @@ failed_job:
|
|||
- chmod 700 ~/.ssh
|
||||
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
|
||||
- chmod 644 ~/.ssh/known_hosts
|
||||
- git config --global user.name "curben-bot"
|
||||
- git config --global user.email "curben-bot@users.noreply.gitlab.com"
|
||||
|
||||
script:
|
||||
- mkdir -p .gitlab/
|
||||
- wget https://img.shields.io/badge/pipeline-failed-critical.svg -O .gitlab/status.svg
|
||||
- git add .gitlab/status.svg
|
||||
- git diff-index --quiet HEAD || git commit -m "Failed pipeline"
|
||||
- ssh git@gitlab.com
|
||||
- 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 || echo
|
||||
- git remote add mirror git@github.com:curbengh/urlhaus-filter.git
|
||||
|
|
Loading…
Reference in New Issue