Docker: stretch -> buster
[oweals/peertube.git] / .gitlab-ci.yml
1 image: chocobozzz/peertube-ci:10
2
3 stages:
4   - build-and-lint
5   - test
6   - docker-nightly
7
8 #before_script:
9 #  - 'sed -i -z "s/database:\n  hostname: ''localhost''/database:\n  hostname: ''postgres''/" config/test.yaml'
10 #  - 'sed -i -z "s/redis:\n  hostname: ''localhost''/redis:\n  hostname: ''redis''/" config/test.yaml'
11 #  - if [[ $CI_JOB_STAGE == "test" ]]; then psql -c "create user peertube with password 'peertube';"; fi
12 #  - NOCLIENT=1 yarn install --pure-lockfile --cache-folder .yarn-cache
13
14 cache:
15   key: yarn
16   paths:
17     - .yarn-cache
18     - cached-fixtures
19
20 ###
21 ## Jobs templates
22 #
23 #.build-and-lint: &build-and-lint
24 #  stage: build-and-lint
25 #
26 #.tests: &tests
27 #  stage: test
28 #  dependencies:
29 #    - build-server
30 #  services:
31 #    - name: postgres:9.6
32 #      alias: postgres
33 #    - name: redis:latest
34 #      alias: redis
35 #  variables:
36 #    PGHOST: postgres
37 #    PGUSER: postgres
38 #    REDIS_HOST: redis
39 #  artifacts:
40 #    expire_in: 1 day
41 #    paths:
42 #      - test*/logs
43 #    when: always
44 #
45 ####
46 ### Build and lint
47 ##
48 #build-server:
49 #  <<: *build-and-lint
50 #  artifacts:
51 #    expire_in: 5h
52 #    paths:
53 #      - dist/
54 #  script:
55 #    - npm run build:server
56 #
57 #lint:
58 #  <<: *build-and-lint
59 #  script:
60 #    - yarn install --pure-lockfile --cache-folder .yarn-cache
61 #    - npm run ci -- "lint"
62 #
63 ####
64 ### Tests
65 #
66 #test-misc:
67 #  <<: *tests
68 #  script:
69 #    - yarn install --pure-lockfile --cache-folder .yarn-cache
70 #    - npm run ci -- "misc"
71 #
72 #test-cli:
73 #  <<: *tests
74 #  retry:
75 #    max: 1
76 #  script:
77 #    - npm run ci -- "cli"
78 #
79 #api:
80 #  <<: *tests
81 #  parallel: 4
82 #  retry:
83 #    max: 1
84 #  script:
85 #    - NODE_PENDING_JOB_WAIT=1000 npm run ci -- api-$CI_NODE_INDEX
86
87 build-nightly:
88   stage: docker-nightly
89   only:
90     - schedules
91   script:
92     - yarn install --pure-lockfile --cache-folder .yarn-cache
93     - npm run nightly
94     - mkdir "${HOME}/.ssh"
95     - chmod 700 "${HOME}/.ssh"
96     - if [ ! -z ${DEPLOYEMENT_KNOWN_HOSTS+x} ]; then echo -e "${DEPLOYEMENT_KNOWN_HOSTS}" > ${HOME}/.ssh/known_hosts; fi
97     - eval `ssh-agent -s`
98     - if [ ! -z ${DEPLOYEMENT_KEY+x} ]; then ssh-add <(echo "${DEPLOYEMENT_KEY}"); fi
99     - if [ ! -z ${DEPLOYEMENT_KEY+x} ]; then scp ./peertube-nightly-* ${DEPLOYEMENT_USER}@${DEPLOYEMENT_HOST}:../../web/nightly; fi
100
101 .docker: &docker
102   stage: docker-nightly
103   cache: {}
104   image:
105     name: gcr.io/kaniko-project/executor:debug
106     entrypoint: [""]
107   before_script:
108     - echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$CI_REGISTRY_AUTH\",\"email\":\"$CI_REGISTRY_EMAIL\"}}}" > /kaniko/.docker/config.json
109   script:
110     - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/support/docker/production/Dockerfile.buster --destination $DOCKER_IMAGE_NAME
111
112 build-docker-develop:
113   <<: *docker
114   only:
115     - schedules
116   variables:
117     DOCKER_IMAGE_NAME: chocobozzz/peertube:develop-buster
118
119 build-docker-tag:
120   <<: *docker
121   only:
122     - tags
123   variables:
124     DOCKER_IMAGE_NAME: chocobozzz/peertube:$CI_COMMIT_TAG-buster
125
126 build-docker-master:
127   <<: *docker
128   only:
129     - master
130   variables:
131     DOCKER_IMAGE_NAME: chocobozzz/peertube:production-buster