forked from gooddata/gooddata-ui-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
87 lines (80 loc) · 3.01 KB
/
.gitlab-ci.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
# (C) 2020 GoodData Corporation
# This file is used to produce GD.UI Web Components artifacts for the usage with Tiger and Panther.
#
# Repository is registered on GitLab using the "CI/CD for external repo" so after the successful merge or PRs in Github,
# this pipeline definition is executed. It's not in any way blocking the existing delivery and deployment in Gitflow delivery process.
#
# It produces docker image which is stored in GitLab CR.
# Delivery is managed by the CI / CD pipeline in gooddata/gdc-nas repository.
---
default:
image: $PANTHER_REPO_URL/infra/tools:$BUILD_IMAGE_VERSION
variables:
BUILD_IMAGE_VERSION: "4.0.0"
stages:
- build
- artifacts
- generate-update
.release:
# We want to avoid unnecessary builds and only create a new Docker image
# for every release commit on master branch.
# Commit message condition is needed to avoid creating a new Docker image on
# every single merge commit to master - that would be a waste.
rules:
- if: '$CI_COMMIT_BRANCH =~ /^(master|release|hotfix\/(tiger|panther)|fast_track)$/ && $CI_COMMIT_MESSAGE =~ /^Release /'
when: manual
.with-buildx:
before_script:
- mkdir -p $HOME/.docker
- cp $DOCKERCONFIG $HOME/.docker/config.json
- docker login -u $DOCKER_BUILDER_USER -p $DOCKER_BUILDER_TOKEN $CI_REGISTRY
- docker login -u $DOCKER_BUILDER_USER -p $DOCKER_BUILDER_TOKEN $CI_DEPENDENCY_PROXY_SERVER
- docker buildx create --use --name=eks_builder --platform=linux/amd64,linux/arm64
--node eks-builder0 --driver=kubernetes
--driver-opt="namespace=gitlab-managed-apps,nodeselector=role=ci,qemu.install=true,replicas=3"
build-web-components:
extends:
- .release
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/node:18
stage: build
cache:
key: build-web-components
paths:
- common/temp/node_modules
- common/temp/pnpm-store
variables:
KUBERNETES_MEMORY_REQUEST: 4Gi
KUBERNETES_MEMORY_LIMIT: 6Gi
script:
- npm i -g @microsoft/rush
- rush install
- rush build --to @gooddata/sdk-ui-web-components
- tar czvf ${CI_PROJECT_DIR}/libs/sdk-ui-web-components/web-components.tar.gz -C ${CI_PROJECT_DIR}/libs/sdk-ui-web-components/esm .
dependencies: []
artifacts:
paths:
- ${CI_PROJECT_DIR}/libs/sdk-ui-web-components/web-components.tar.gz
docker-build-web-components:
extends:
- .release
- .with-buildx
stage: artifacts
variables:
IMAGE_ID: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
KUBERNETES_MEMORY_REQUEST: 200Mi
script:
- cd ${CI_PROJECT_DIR}/libs/sdk-ui-web-components
- docker buildx build --push --cache-from $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
--build-arg REPO_PREFIX=$CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX/
-t $IMAGE_ID -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG -f Dockerfile .
dependencies:
- build-web-components
generate-update:
extends:
- .release
stage: generate-update
variables:
KUBERNETES_MEMORY_REQUEST: 100Mi
script:
- /scripts/update_ext_image_version.py web-components
dependencies: []