generated from unity-sds/unity-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitlab-ci.yml.one_job
106 lines (94 loc) · 3.64 KB
/
gitlab-ci.yml.one_job
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# This pipeline file requires preprocessing. It has three string
# tokens that must be replaces with correct values. The tokens are
# - UVENUE : Unity venue, 'dev', 'test' or 'prod' lowercase only)
# - APGTAG : git tag for the desired version of app-pack-generator
# - UAGTAG : git tag for the desired version of unity-app-generator
# For example, this file can be preprocessed like
# cat gitlab-ci.yml.one_job | sed s/UVENUE/dev/ | sed s/APGTAG/0.4.0/ | sed s/UAGTAG/0.3.0/ > .gitlab-ci.yml
# This is the default section. The "default" keyword (section) lets
# you set default values for other keywords globally. The default
# values can be overridden at different parts of the pipeline when
# needed.
#
default:
tags:
- unity
- shell
- UVENUE
# This piepline has four stages
#
stages:
- build
- test
- push
- deploy
# None of the following jobs are using "tags" keyword because the
# default "tags" defined above works for all.
# Unity-app-generator commands must be executed sequentially and in
# the order given here, i.e
# 1) init
# 2) build_docker
# 3) push_docker
# 4) build_cwl
# 5) push_app_registery
# Even build_cwl must happen after push_docker because the correct
# Docker image location, which is written into the CWL files by
# build_cwl command, is established after push_docker command.
#
# The following are needed group-level gitlab CI/CD variables:
# 1) DH_USERNAME: docker hub username
# 2) DH_PASSWORD: docker hub password
# 3) DH_REGISTRY_URL: docker hub registry URL
# 4) APPGEN_DOCKER_URL: currently same as DH_USERNAME
# 5) APPGEN_DOCKSTORE_URL: dockstore URL
# 6) APPGEN_DOCKSTORE_TOKEN: dockstore access token
# Instructions for defining group-level variables are given at
# https://docs.gitlab.com/ee/ci/variables/#for-a-group
# There is no such thing as "account-level" variables.
#
build-app-gen:
stage: build
script:
- echo "The account used to build the pipeline is `whoami`."
- echo "Printing some predefined pipeline variables:"
- echo "CI_PROJECT_URL is $CI_PROJECT_URL"
- echo "CI_REPOSITORY_URL is $CI_REPOSITORY_URL"
- echo "CI_PROJECT_DIR is $CI_PROJECT_DIR"
- echo "CI_PROJECT_ID is $CI_PROJECT_ID"
- echo "CI_PROJECT_NAME is $CI_PROJECT_NAME"
- TEMPDIR=`date -u +\%Y\%m\%d\%H\%M\%S`_temp_cloned
- mkdir ~/$TEMPDIR
- cd ~/$TEMPDIR
- umask 002
- virtualenv venv
- source venv/bin/activate
- git clone --depth 1 --branch APGTAG https://github.com/unity-sds/app-pack-generator.git
- pip3 install app-pack-generator/
- git clone --depth 1 --branch UAGTAG https://github.com/unity-sds/unity-app-generator.git
- pip3 install unity-app-generator/
- docker login -u $DH_USERNAME -p $DH_PASSWORD $DH_REGISTRY_URL
- python3 -m unity_app_generator init $CI_PROJECT_DIR
- cd $CI_PROJECT_DIR
- python3 -m unity_app_generator build_docker
- python3 -m unity_app_generator push_docker $APPGEN_DOCKER_URL
- python3 -m unity_app_generator build_cwl
- python3 -m unity_app_generator push_app_registry --api_url $APPGEN_DOCKSTORE_URL --token $APPGEN_DOCKSTORE_TOKEN
- docker rmi -f $(docker images -q)
- cd ~
- deactivate
- rm -rf ~/$TEMPDIR
test-app-gen:
stage: test
script:
- echo "The account used to test the pipeline is `whoami`."
- echo "Test stage not implemented yet."
push-app-gen:
stage: push
script:
- echo "The account used to push the build result(s) is `whoami`."
- echo "Push stage not implemented yet."
deploy-app-gen:
stage: deploy
script:
- echo "The account used to deploy the build result(s) is `whoami`."
- echo "Deploy stage not implemented yet."