This is an internal documentation. There is a good chance you’re looking for something else. See Disclaimer.
CI
Setup
Gitlab is used as host provider and CI of the tocco-client project.
The triggered pipelines can be inspected here: Gitlab CI Pipelines.
Stages and Jobs
Alls jobs can be found in the .gitlab-ci.yml file in the root.
There are a set of jobs that are triggered for every merge request and push to master. The jobs ensure, that the linting command and all unit tests run successfully and storybook can be build. Also the builded storybook gets pushed to the Gitlab Storybook Repository and a link to this storybook deployment is written as comment to the merge request.
There is also a scheduled pipeline that runs daily on master testing all the above and also runs the more time consuming end-to-end tests with cypress.
Also there are two jobs that support the development workflow. One job handles the auto-releasing of packages on the release branches (if the changelog is not empty a package is released) on each commit. The last job handles cherry-picking across different versions and is described here Cherry-pick job
Caching
All node_modules folder are getting cached since a installation of all dependencies from scratch takes very long. The yarn.lock files act as keys. That means if a dependency changes, a new cache is created. Each job should define if it pull, pushed or pull and pushed to the cache to speed things up.
Image
As docker image the linux alpine version is used to speed up the image initialization phase by several seconds. As downside of this optimization, some dependencies must be installed by a job with apk.
Storybook
On release branches and master the storybook is daily built. For merge requests per default no storybook is built. However the storybook job can be manual triggered in the Gitlab UI by clicking on the play button of the job:
Gitlab merge request pipeline
Releasing
Manual trigger releasing
Using schedule (releasing all packages)
If all packages should be released open Pipeline Schedules and run the job of the corresponding branch.
Using pipeline (releasing only some packages)
Open Run Pipeline on Gitlab. Select the branch where you want to manually release (either master or nice-releases/VERSION).
The following variables can be passed:
CI_RUN_AUTO_RELEASE(mandatory): must be set to1that the releasing is startedCI_RELEASING_PACKAGES(optional): per default the releasing is started for all releasable packages. if a comma-separated list is passed (e.g.admin,devcon) only these packages are release candidatesCI_RELEASING_FORCE(optional): per default a package is only released if the changelog is not empty. iftrueis passed as value the package is always released
Fix failing job
If the releasing job fails on the Gitlab CI, some packages are already published to NPM but the new version is not committed to the release/master branch. First you must manually change these versions (check log to know which packages were already released). Commit these changes and merge them. Last you must move for each package the git tag. You must execute:
git checkout ${COMMIT_ID}
git tag ${PACKAGE_NAME}/${RELEASE_TAG} -f
git push origin ${PACKAGE_NAME}/${RELEASE_TAG} -f
COMMIT_ID: commit id on the release/master branch of your created commit on GitlabPACKAGE_NAME: npm package name which always has the tocco prefix (e.g.tocco-admin)RELEASE_TAG: npm release tag name (e.g.nice34). On the master the tag is named like the upcoming version
Cherry-pick job
Fix failing cherry-pick job
For example there could be an auto merge conflict. In such a case there is log message like this:
CONFLICT (content): Merge conflict in packages/entity-browser/src/routes/list/containers/ListViewContainer.js
Workflow for fixing (in the example the source branch is nice-releases/227 and the target branch nice-releases/228) :
Check log which commits are cherry-picked (see line 2 und 3):
Order of commits to cherry-pick:
- 952f1e0fd57f000f9bed1a0969efceaaed43e10c
- 00f9bed1a0969efceaaed43e10c952f1e0fd57f0
Checkout the target branch
Cherry pick the commits with
git cherry-pick ${COMMIT_ID} -xand fix conflictsCreate a MR
Optional: if the MR is approved release all necessary packages (all necessary packages will be released automatically every night)
Move the auto merge tag to the head of the source branch
git checkout ${HEAD_COMMIT_ID}
git tag -f auto-merge/${SOURCE_BRANCH_NICE_VERSION}
git push origin auto-merge/${SOURCE_BRANCH_NICE_VERSION} -f
Merge Request
There is one job that automates the creation of merge requests after a successful release of a package (or cherry picking), the branch containing the release (or cherry picked) commits must be rebased to its target branch using a merge request.
CI scripts on different versions
In version 2.27 many client CI scripts were introduced or adjusted such as auto-releasing or cherry-picking.
If a CI feature is added or modified this should be done ideally on version 2.27 if possible.
However between 2.27 and the latest version are some differences in the scripts which are documented here.
The command git diff origin/nice-releases/34 .gitlab-ci.yml scripts ':!scripts/nice2' ':!scripts/widgets'
(on branch nice-releases/35) is used to extract the difference
(Folder nice2 and widgets are excluded as the are only used by Cypress which runs on the master branch).
Changed in version 3.4
.gitlab-ci.yml
variables
NICE_VERSION,DOCKER_NICE_VERSION,NICE_TIMEOUT_SECS,S3_SECRET_ACCESS_KEY,CYPRESS_API_KEY,CYPRESS_PASSWORD,CYPRESS_USER,CYPRESS_USER_API_KEY_HASH,CYPRESS_USER_PASSWORD_HASHadded.nice-as-serviceaddedyarn_setup job runs now also on
schedulescypress job
extends
.nice-as-serviceCYPRESS_INSTALL_BINARYversion changedvariables
HIBERNATE_MAIN_SERVERNAME,HIBERNATE_MAIN_DATABASENAME,POSTGRES_USER,CYPRESS_BASE_URL,BACKEND_URLreplace scripts
msg-validation.js
add command
remove unused code
Changed in version 3.5
.gitlab-ci.yml
variable
NICE_VERSIONremovedvariable
POSTGRES_VERSIONadded and Postgres updated to v15test job
artifacts are no longer saved
command
yarn test:ciinstead ofyarn test --ci
cypress job
CYPRESS_INSTALL_BINARYversion changedadd command
yarn db:create-templaterun cypress with
--browser chrome
sonarqube job no longer depends on test job
helpers.sh
in method
getDevDependenciesGrepscommand adjusted to extract dev dependencies after updating lerna
Changed in version 3.6
.gitlab-ci.yml
image from node 16 to node 18 updated
cypress job
CYPRESS_INSTALL_BINARYversion changed
Changed in version 3.7
.gitlab-ci.yml
cypress job
CYPRESS_INSTALL_BINARYversion changedyarn cypress:run --browser chromereplaced withyarn cypress:run
add customer sonarqube job
Changed in version 3.8
.gitlab-ci.yml
removed tagging script
adjust command for releasing
adjust command for branch protection
remove gitlab job
storybook-linkand do command instorybook-mradd stage
cleanupand job to handle failed cherry-pick pipelines
else
rename
protect-branch.jstoprotectBranch.jsrewrite of releasing script
added files
helpers/*,cherrypick.js,releasePackages.js,releasePackagesHelpers.js,releasePackagesHelpers.spec.js,storybookBranch.js,storybookHelpers.js,storybookHelpers.spec.js,storybookMergeRequest.js,validateCommitMessage.js,validateCommitMessageHelpers.js,validateCommitMessageHelpers.spec.jsandvariables.jsonremoved files
auto-release.sh,build_storybook_mr_target.sh,cherrypick.sh,deploy_storybook_gitlab.sh,git.sh,helpers.sh,msg-validation.js,release-package.sh,release-packages.sh,storybook_link_gitlab.shandtagging.sh
send slack message when cherry-pick merge request could not have been created (
handleFailedMergeRequest.js)only release customer bundle if there is an installation
migrate release message slack integration
Changed in version 3.9
.gitlab-ci.yml
use latest node 20 alpine image
removed
SPRING_PROFILEas variable of.nice-as-servicecypress job
CYPRESS_INSTALL_BINARYversion changed
sonarqube job
updated from jdk11 to jdk17
Changed in version 3.10
.gitlab-ci.yml
adjusted
before_scriptof.nice-as-service(no longer use asc files)
else
remove
google.ascandpostgres.ascsonarqube job
-Dsonar.login=$SONARQUBE_KEYreplaced with-Dsonar.token=$SONARQUBE_KEY
Changed in version 3.11
.gitlab-ci.yml
use latest node 22 alpine image
cypress job
use node 22 cypress image
CYPRESS_INSTALL_BINARYversion changed
define abstract
yarnv4and extend all existing gitlab jobs. if the job has abefore_scriptit must manually extend thebefore_scriptofyarnv4add job
failed-mr
releasePackages.js
adjust git adding files
adjust yarn publish for yarn v4 (renamed method
writeYarnrcand new command foryarn publish)use yarn version for version update (replaces
--new-versionargument)
releasePackagesHelpers.js
complete rewrite of method
writeNpmrc/writeYarnrc
handleFailedMergeRequest.js
new script
else
update from yarn v1 to yarn v4
Changed in version 3.12
.gitlab-ci.yml
adjust caching of
yarn_setupadjust job
failed-mr
releasePackagesHelpers.js
remove duplicates from changelog
fileSystem.js
add more logging
Changed in version 3.13
.gitlab-ci.yml
add global variable
ADDRESS_PROVIDER_PASSWORDremove
yarn set version berryfrom.yarnv4adjust tag of
cypressjobCYPRESS_INSTALL_BINARYversion changedadd job
validate-dependenciesupdate s3 accessKeyId
add job
pagesintegrate sonarqube with gitlab
validateDependencies.js / validateDependenciesHelpers.js
new script
helpers.js
optimize getAllToccoDependencies
Changed in version 3.14
.gitlab-ci.yml
upgrade to postgres 17
CYPRESS_INSTALL_BINARYversion changedadd job
validate-commit-messageuse latest node 24 alpine image
add job
typecheckremove cypress logic as this in now in an own repo
validateCommitMessageMr.js
new script
validateDependencies.js
remove ignored dependencies
exclude tocco-types in dependency validation
releasePackagesHelpers.js
check if package has a package.json
variables.json
set min node major version