Newer
Older
---
# --------------------------------------------------------------------------------------
# Global
# --------------------------------------------------------------------------------------
include:
- project: '${CI_PROJECT_ROOT_NAMESPACE}/yocto/infrastructure/gitlab-ci'
ref: ${GITLAB_CI_REVISION}
file:
- build-pipeline.yml
- common.yml
stages:
- Build
- Test
# --------------------------------------------------------------------------------------
# Stage: Build
# --------------------------------------------------------------------------------------
.build: &build
- cd ${CI_PROJECT_DIR}
- VERSION=$(cd .repo/manifests && git describe --tags)
- cat .repo/manifests/default.xml
- find foo -name "[0-9]*.txt" -printf '%P\n' | sort -V > files-foo-$VERSION.txt
- cat files-foo-$VERSION.txt
- find bar -name "[0-9]*.txt" -printf '%P\n' | sort -V > files-bar-$VERSION.txt
- cat files-bar-$VERSION.txt
- FOO_FILES=$(cat files-foo-$VERSION.txt | wc -l)
- BAR_FILES=$(cat files-bar-$VERSION.txt | wc -l)
- DIFF=$((BAR_FILES-FOO_FILES))
- (($DIFF >= -1 && $DIFF <= 1))
build:files:
stage: Build
extends:
- .buildbase
tags:
- infrastructure
needs: []
timeout: 2m
variables:
GIT_STRATEGY: none
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
107
108
109
110
111
112
before_script:
- !reference [.docker_check]
- !reference [.setup_ssh]
- !reference [.repo_checkout]
script:
- *build
artifacts:
paths:
- files-*
build:echo:
stage: Build
tags:
- infrastructure
needs: []
timeout: 2m
image: ${CI_IMAGE_PYTHON}
script:
- printenv
- echo "Build successful"
build:check-foo-branch:
stage: Build
extends:
- .buildbase
tags:
- infrastructure
needs: []
timeout: 2m
variables:
GIT_STRATEGY: none
before_script:
- !reference [.docker_check]
- !reference [.setup_ssh]
- !reference [.repo_checkout]
script: |
echo "repo branch: $MASTER_BRANCH"
echo "foo branch: $(cat foo/branch.txt)"
if [[ "$MASTER_BRANCH" != $(cat foo/branch.txt) ]]; then
echo "ERROR: Branches do not match!"
exit 1
fi
artifacts: null
cache: null
# --------------------------------------------------------------------------------------
# Stage: Test
# --------------------------------------------------------------------------------------
.test_simple:
stage: Test
rules:
- when: manual
allow_failure: true
tags:
- infrastructure
image: ${CI_IMAGE_PYTHON}
script:
- exit ${RETURNCODE}
test:pass:
extends:
- .test_simple
variables:
RETURNCODE: 0
test:fail:
extends:
- .test_simple
variables:
RETURNCODE: 1