-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
48 lines (40 loc) · 1.61 KB
/
.gitlab-ci.yml
File metadata and controls
48 lines (40 loc) · 1.61 KB
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
# Updated: 2019-06-05
# Purpose: On the update of the webserver's code, this CI/CD script will build the website & server
# system, create a compressed archive with the output files, and upload that to staging.
# It will also update buildlog in the pvtest repo, kicking off rest of the CI test process.
variables:
COMPONENT : 'website'
PROJECT_INT : 'vaunt'
PROJECT : 'crimson'
VERSION_LENGTH : 40
stages:
- build
# Dpcker image brings in git, build-essential, curl; runs bash
image: cfriedt/toolchain:xenial
#################
##### BUILD #####
#################
build-website:
stage: build
before_script:
- apt-get update && apt-get install ftp
script:
# Capture current date
- DATE=$(TZ=UTC date +%F-s%s | tr - _)
# Put git version file
- DUMPDIR=/tmp/$COMPONENT-site-$DATE
- mkdir $DUMPDIR
- mkdir $DUMPDIR/.ci_info
- echo $CI_COMMIT_SHA >> $DUMPDIR/.ci_info/gitversion
# Upload tarball for staging
- dir=$(pwd)
- cd $DUMPDIR
- NEW_TAR=$PROJECT-$COMPONENT-build-$DATE.tar.gz
- tar -cvzf $dir/$NEW_TAR * || true
- cd $dir
- sh .ci/ftp-stage-tarball.sh $dir $NEW_TAR
- rm $NEW_TAR
- rm -rf $DUMPDIR
# Trigger downstream CI Pipeline
- VERSION=$(echo $CI_COMMIT_SHA | cut -c 1-$VERSION_LENGTH)
- "curl --request POST --form token=$CI_JOB_TOKEN --form 'variables[NEW_TAR]=$NEW_TAR' --form 'variables[VERSION]=$VERSION' --form ref=master http://ci.korbin.pv/api/v4/projects/57/trigger/pipeline"