This folder includes devops related routine and consists of the following parts:
- Makefile automates devops tasks like test, package and publish to crates.io which could be performed either on-host or in-docker
- docker folder holds docker related routine
- aws-codebuild folder consists of files that describes AWS CodeBuild based CI/CD pipelines
- ext folder is a git-subrepo of shared library which provides makefile based approach of devops tasks automation. Please check its README.md for more information.
MySQL Storage Wallet Plugin is shipped with dockerfiles for ubuntu xenial and centos7 which describe images with necessary environment for CI/CD tasks on these OSes.
CI pipeline is described by Jenkinsfile.ci. It uses Jenkins shared library API to build projects on AWS CodeBuild. CI utilizes docker containers from docker/ci folder to run tests on both ubuntu xenial
and centos7
.
CI pipeline stages:
- clone the GitHub repository
- upload current HEAD as zip archive to AWS S3 bucket used by CodeBuild project
- launch a CodeBuild project using
AwsCodeBuildHelper.build
API. It includes a set of sub-stages:- (optional) create/update the CodeBuild project
- (optional) create an AWS ECR repository to use by CodeBuild project
- (optional) build docker image and push it to the AWS ECR repository
- run the CodeBuild project to perform cargo testing
- download logs
- archive logs
CD pipeline is described by Jenkinsfile.cd. It uses Jenkins shared library API as well. For now CD generates artifacts (debian package) only for ubuntu xenial
.
CD pipeline stages:
- clone the GitHub repository
- resolve the following parameters:
- current source version from Cargo.toml
- last revision number among the debian packages with the same source version in Evernym debian repo
- evaluate new debian package version basing on source version, last revision number and current build number
- upload current HEAD as zip archive to AWS S3 bucket used by CodeBuild project
- launch a CodeBuild project using the same
AwsCodeBuildHelper.build
API as CI does. The main difference here is that CD pipeline doesn't build an image for AWS ECR repository assuming that it has been done previously by CI pipeline. Its sub-stages:- (optional) create/update CodeBuild project (TODO shouldn't do that in any case assuming CI did that)
- run the CodeBuild project to perform debian packaging
- download logs
- archive logs
- upload created debian package to Evernym debian repo
- make
- docker
- docker-compose
test_dry
runs tests in "dry" mode:cargo test --no-run
test
runs tests:cargo test
build
runscargo build
publish_crate
publishes the code to crates.io performing cargologin
,package
andpublish
commandsimage_ci
builds docker image with necessary environment for performing both CI and CD tasksimage_ci_version
prints current version of the docker image (dockerfile) built byimage_ci
target- please refer to ext/README.md for list of targets inherited from there
Each target could be run in two ways - with or without _in_docker
postfix: e.g. test_in_docker
and test
. In former case the target is run inside docker container (though it makes sense not for all targets), otherwise current host's environment is used.
PROJECT_DIR
: absolute path of the top level project dir. Default: resolved asgit rev-parse --show-toplevel
RELEASE
: adds--release
flag to cargotest
andbuild
commands if set to1
. Default:1
OSNAME
: switches OS context, possible values:xenial
,centos7
. Default:xenial
CARGO_TARGET_DIR
: sets CARGO_TARGET_DIR environment variable. Default:target/$(OSNAME)
CRATE_P_VERSION
: if set overwritesversion
field of[package]
section in Cargo.toml before crate publishing. Default: not setCARGO_LOGIN_TOKEN
: token to performcargo login
during crate publishing. Default: not setDOCKER_NAME
: name of the image built byimage_ci
target. Default:evernym/mysql-wallet-storage
DOCKER_TAG
: tag of the image built byimage_ci
target. Default:<VERSION>-$(OSNAME)-ci
, whereVERSION
is value ofCI_ENV_VERSION
environment variable in accordant dockerfile- please refer to ext/README.md for list of environment variables inherited from there