summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: c560737e9d7353bc9e4dfc6a1b96979f8ad25de9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
image: docker:stable

workflow:
  rules:
    - if: $CI_COMMIT_BRANCH == "gitlab"

stages:
  - main

main-job:
  stage: main
  before_script:
    - apk update && apk add git jq make curl python3 bash openssh-client

    - git config user.email "_@users.noreply.gitlab.com"
    - git config user.name "Snapshot Automation Bot"
    - git remote add cdci_origin git@gitlab.com:$CI_PROJECT_PATH.git

    - eval `ssh-agent -s`
    - echo "${SSH_PRIVATE_KEY_TOOLKIT}" | tr -d '\r' | ssh-add - > /dev/null
    - echo "${SSH_PRIVATE_KEY_MIRROR}" | tr -d '\r' | ssh-add - > /dev/null

    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - touch ~/.ssh/config
    - echo -e "Host gitlab.com\n\tStrictHostKeyChecking no" >> ~/.ssh/config
    - echo "$SSH_KNOWN_HOSTS_MIRROR" >> ~/.ssh/known_hosts
    - chmod 600 ~/.ssh/config ~/.ssh/known_hosts
  script:
    - git checkout gitlab

    - make clean
    - make

    - git add --all
    - git commit -sm 'Data snapshot commit'
    - git push cdci_origin gitlab

    - ssh -T cdci@embla.dev.snart.me