edgex
Overview
Shared library of common helper functions for all EdgeX Jenkins pipelines.
Functions
edgex.isReleaseStream: Used to validate whether the current branch that Jenkins is building is a branch that is considered a branch with "releasable" artifacts (i.e docker push, git semver push).edgex.isLTS: Used to determine if the current branch that Jenkins is building is for an LTS release.edgex.getTargetBranch: Used to determine the target branch that is being merged into for a PR.edgex.didChange: Determine if the given expression matches the files that changed in a given PR or merge. For example:// Did any .go files change from the current branch compared to origin/main didChange('*.go') // Did any .yaml files change from the current branch compared to origin/release didChange('*.yaml', 'origin/release')edgex.mainNode: Given a config map withconfig.nodes, either return the node label marked asdefaultNode = trueor return the DevOps managed "default" node label.edgex.nodeExists: Verify a given node architecture matches provided architecture.edgex.getNode: Return node with architecture that matches provided architecture.edgex.setupNodes: Setup default node labels for x86_64 and arm64 nodes.edgex.getVmArch: Run uname to determine VM architecture. Ifaarch64is returned, convert to the result toarm64.edgex.bannerMessage: Vanity function to wrap given input message with a banner style output for easier readability in Jenkins console.edgex.printMap: Vanity function to print Groovy Map to the Jenkins console.edgex.defaultTrue: Returns true if the input istrueornull. This is useful to setup default values in functions when none is provided.edgex.defaultFalse: Returns true if the input isfalseornull. This is useful to setup default values in functions when none is provided.edgex.releaseInfo: Call shell scriptresources/releaseinfo.shto output current edgex-global-pipeline version information in the Jenkins console. This is really useful for debugging older builds in case issues are discovered.edgex.isDryRun: Whether or not theenv.DRY_RUNenvironment variable is set. Will returntrueif DRY_RUN is set,falseotherwise.edgex.isMergeCommit: Determines if the current commit Jenkins is building is considered a git "merge commit". Useful if determining parent commit info.edgex.getPreviousCommit: Determines the previous commit SHA given the merge commit or squash commit git use-cases. Different git commands have to be run to be able to determine the previous commit.edgex.getBranchName: Returns the current branch name from git.edgex.getCommitMessage: Returns the current commit message from git given a commit SHA.edgex.isBuildCommit: Return true when the commit message follows the patternbuild(...): [semanticVersion,namedTag] ....edgex.parseBuildCommit: Return the parameters for the build[semanticVersion,namedTag].edgex.getTmpDir: Runmktempwith given pattern to create a temporary directory in/tmp.edgex.getGoLangBaseImage: Return DevOps managed base images used in Go pipelines.edgex.isGoProject: Looks at repository directory structure to determine if the repository is Golang based. Uses the existence of thego.modfile.edgex.getCBaseImage: Return the base image used as the base image for all C based repositories.edgex.parallelJobCost: Wraps call tolfParallelCostCaptureinside docker image to save time downloading pip dependencies.edgex.isLTSReleaseBuild: Returnstrueif current commit message begins withci(lts-release).edgex.semverPrep: Poorly named function that sets up theenv.NAMED_TAGandenv.BUILD_STABLE_DOCKER_IMAGEfor the build commit concept. Will be removed in a future release.edgex.waitFor: Useful function to wait for a condition in a shell script to be met.edgex.waitForImages: Useful function to determine if a docker image has been pushed to a repository.edgex.commitChange: Commits a change to the repo with a given message.edgex.createPR: Creates a PR with the GitHub CLI for with a given branch, title, message and reviewers for. Note: This is generic enough to be used in other functions.