This repository has been archived by the owner on Apr 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 111
/
.travis.yml
196 lines (186 loc) · 6.39 KB
/
.travis.yml
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#
# Copyright (c) 2021 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
# Che-Theia workflow
dist: focal
os: linux
cache: false
git:
depth: false
language: node_js
node_js: "12.20.1"
before_install:
- |
if [[ "${TRAVIS_CPU_ARCH}" == "ppc64le" ]]; then
# fix cpu count to avoid OOM failure
cat /proc/stat > /tmp/stat
sed -i '/^cpu[4-9]/d' /tmp/stat
sed -i '/^cpu[0-9][0-9]/d' /tmp/stat
sudo mount --bind /tmp/stat /proc/stat
fi
install:
# TODO when we're confident that sha-tagged travis-built images won't collide with GHA built ones, we can remove the -travis suffix here
- export SHORT_SHA=$(git rev-parse --short HEAD)-travis
- export GITHUB_TOKEN="$CHE_BOT_GITHUB_TOKEN"
- echo "$RH_CHE_AUTOMATION_DOCKERHUB_PASSWORD" | docker login -u "$RH_CHE_AUTOMATION_DOCKERHUB_USERNAME" --password-stdin
- echo "$QUAY_ECLIPSE_CHE_PASSWORD" | docker login quay.io -u "$QUAY_ECLIPSE_CHE_USERNAME" --password-stdin
env:
global:
- TAG=next-travis
- REGISTRY=quay.io
- ORGANIZATION=eclipse
- PR_NUMBER=
jobs:
fast_finish: true
allow_failures:
- if: env(PR_NUMBER) IS present
arch: arm64-graviton2
- if: env(PR_NUMBER) IS present
arch: ppc64le
- if: env(PR_NUMBER) IS present
arch: s390x
include:
- &node-build
stage: PR Check
name: Node Build on amd64
if: env(PR_NUMBER) IS present
arch: amd64
install:
- sudo apt-get update && sudo apt-get install -y libsecret-1-dev
- git fetch origin +refs/pull/${PR_NUMBER}/merge
- git checkout -qf FETCH_HEAD
script: yarn
- <<: *node-build
name: Node Build on arm64
arch: arm64-graviton2
group: edge
virt: vm
- <<: *node-build
name: Node Build on ppc64le
arch: ppc64le
- <<: *node-build
name: Node Build on s390x
arch: s390x
- &docker-build
if: env(PR_NUMBER) IS present
name: Docker build (Alpine) on amd64
arch: amd64
env: DIST=alpine
install:
- git fetch origin +refs/pull/${PR_NUMBER}/merge
- git checkout -qf FETCH_HEAD
script:
- |
set -e
docker image prune -a -f
docker pull quay.io/eclipse/che-theia-dev:next-travis && \
docker tag quay.io/eclipse/che-theia-dev:next-travis eclipse/che-theia-dev:next-travis || true
TAG=$TAG-${TRAVIS_CPU_ARCH} ./build.sh --root-yarn-opts:--ignore-scripts --dockerfile:Dockerfile.$DIST
- <<: *docker-build
name: Docker build (Alpine) on arm64
arch: arm64-graviton2
group: edge
virt: vm
- <<: *docker-build
name: Docker build (Alpine) on ppc64le
arch: ppc64le
- <<: *docker-build
name: Docker build (Alpine) on s390x
arch: s390x
- <<: *docker-build
name: Docker build (ubi8) on amd64
arch: amd64
env: DIST=ubi8
- <<: *docker-build
name: Docker build (ubi8) on arm64
arch: arm64-graviton2
group: edge
virt: vm
env: DIST=ubi8
- <<: *docker-build
name: Docker build (ubi8) on ppc64le
arch: ppc64le
env: DIST=ubi8
- <<: *docker-build
name: Docker build (ubi8) on s390x
arch: s390x
env: DIST=ubi8
- &build-and-push-next
stage: Build & Publish 'next-travis'
name: Build & Publish image on amd64
if: type = api AND branch = main AND env(TAG) = "next-travis" AND env(THEIA_GITHUB_REPO) IS blank AND env(PR_NUMBER) IS blank
arch: amd64
script:
- |
set -e
docker image prune -a -f
SUFFIX=travis-${TRAVIS_CPU_ARCH} TAG=$TAG-${TRAVIS_CPU_ARCH} ./build.sh --root-yarn-opts:--ignore-scripts --dockerfile:Dockerfile.alpine --push
- <<: *build-and-push-next
arch: arm64-graviton2
group: edge
virt: vm
name: Build & Publish image on arm64
- <<: *build-and-push-next
arch: ppc64le
name: Build & Publish image on ppc64le
- <<: *build-and-push-next
arch: s390x
name: Build & Publish image on s390x
- stage: Publish multiarch image with 'next-travis' tag
if: type = api AND branch = main AND env(TAG) = "next-travis" AND env(THEIA_GITHUB_REPO) IS blank AND env(PR_NUMBER) IS blank
name: Publish multiarch image with next-travis tag
script: .ci/travis/publish_multiarch.sh
- &check-a-theia-branch
stage: Check a Theia branch
name: Build an image against Theia branch on amd64
arch: amd64
if: type = api AND env(THEIA_GITHUB_REPO) AND env(THEIA_BRANCH)
script:
- |
set -e
docker image prune -a -f
docker pull quay.io/eclipse/che-theia-dev:next-travis
docker tag quay.io/eclipse/che-theia-dev:next-travis eclipse/che-theia-dev:next-travis
TAG=$TAG-${TRAVIS_CPU_ARCH} ./build.sh --root-yarn-opts:--ignore-scripts --dockerfile:Dockerfile.alpine --build-args:THEIA_GITHUB_REPO=${THEIA_GITHUB_REPO} --branch:${THEIA_BRANCH}
- <<: *check-a-theia-branch
arch: arm64-graviton2
group: edge
virt: vm
name: Build an image against Theia branch on arm64
- <<: *check-a-theia-branch
arch: ppc64le
name: Build an image against Theia branch on ppc64le
- <<: *check-a-theia-branch
arch: s390x
name: Build an image against Theia branch on s390x
#Release Workflow
- &release-che-theia
stage: Release che-theia
name: Build and publish image on amd64
if: type = api AND env(TAG) IS present AND env(TAG) != "next-travis"
arch: amd64
script:
- |
BRANCH=${TAG%.*}.x
git checkout "${BRANCH}"
TAG=$TAG-travis
docker image prune -a -f
SUFFIX=travis-${TRAVIS_CPU_ARCH} TAG=$TAG-${TRAVIS_CPU_ARCH} ./build.sh --root-yarn-opts:--ignore-scripts --dockerfile:Dockerfile.alpine --push
- <<: *release-che-theia
arch: arm64-graviton2
group: edge
virt: vm
name: Build and publish image on arm64
- <<: *release-che-theia
arch: ppc64le
name: Build and publish image on ppc64le
- <<: *release-che-theia
arch: s390x
name: Build and publish image on s390x
- stage: Publish multiarch image
if: type = api AND env(TAG) IS present AND env(TAG) != "next-travis"
script: TAG=$TAG-travis .ci/travis/publish_multiarch.sh