Skip to content

edgeXBuildCApp

Shared Library to build C projects

Overview

edgeXBuildCApp

Parameters

Name Required Type Description and Default Value
project required str The name of your project.
mavenSettings optional str The maven settings file in Jenkins that has been created for your project. Note the maven settings file specified must exist in Jenkins in order for your project to build.

Default: ${project}-settings
semver optional bool Specify if semantic versioning will be used to version your project. Note edgeX utilizes git-semver for semantic versioning.

Default: true
testScript optional str The command the build will use to test your project. Note the specified test script will execute in the project's CI build container.

Default: make test
buildScript optional str The command the build will use to build your project.

Default: make build
dockerBaseImage optional str The docker base image for your project.

Default: nexus3.edgexfoundry.org:10003/edgex-devops/edgex-gcc-base:latest
dockerFilePath optional str The path to the Dockerfile for your project.

Default: Dockerfile
dockerBuildFilePath optional str The path to the Dockerfile that will serve as the CI build image for your project.

Default: Dockerfile.build
dockerBuildContext optional str The path for Docker to use as its build context when building your project. This applies to building both the CI build image and project image.

Default: .
dockerBuildImageTarget optional str The name of the docker multi-stage-build stage the pipeline will use when building the CI build image.

Default: builder
dockerBuildArgs optional list The list of additonal arguments to pass to Docker when building the image for your project.

Default: []
dockerNamespace optional str The docker registry namespace to use when publishing Docker images. Note for EdgeX projects images are published to the root of the docker registry and thus the namespace should be empty.

Default: ''
dockerImageName optional str The name of the Docker image for your project.

Default: docker-${project}
dockerNexusRepo optional str The name of the Docker Nexus repository where the project Docker image dockerImageName will be published to if pushImage is set.

Default: staging
buildImage optional bool Specify if Jenkins should build a Docker image for your project. Note if false then pushImage will also be set to false.

Default: true
pushImage optional bool Specify if Jenkins should push your project's image to dockerNexusRepo.

Default: true
semverBump optional str The semver axis to bump, see git-semver for valid axis values.

Default: pre
buildSnap optional bool Specify if Jenkins should build a Snap for your project. Note If set, your project must also include a valid snapcraft yaml snap/snapcraft.yaml for Jenkins to attempt to build the Snap.

Default: false
failureNotify optional str The group emails (comma-delimited) to email when the Jenkins job fails.

Default: edgex-tsc-core@lists.edgexfoundry.org,edgex-tsc-devops@lists.edgexfoundry.org
arch optional array A list of system architectures to target for the build. Possible values are amd64 or arm64.

Default: ['amd64', 'arm64']

Usage

Basic example

edgeXBuildCApp (
   project: 'device-bacnet-c'
)

Complex example

edgeXBuildCApp (
    project: 'device-sdk-c',
    dockerBuildFilePath: 'scripts/Dockerfile.alpine-3.11-base',
    dockerFilePath: 'scripts/Dockerfile.alpine-3.11',
    testScript: 'apk add --update --no-cache openssl ca-certificates && make test',
    pushImage: false
)

Full example

This example shows all the settings that can be specified and their default values.

edgeXBuildCApp (
    project: 'c-project',
    mavenSettings: 'c-project-settings',
    semver: true,
    testScript: 'make test',
    buildScript: 'make build',
    dockerBaseImage: 'nexus3.edgexfoundry.org:10003/edgex-devops/edgex-gcc-base:latest',
    dockerFilePath: 'Dockerfile',
    dockerBuildFilePath: 'Dockerfile.build',
    dockerBuildContext: '.',
    dockerBuildArgs: [],
    dockerNamespace: '',
    dockerImageName: 'docker-c-project',
    dockerNexusRepo: 'staging',
    buildImage: true,
    pushImage: true,
    semverBump: 'pre',
    buildSnap: false,
    failureNotify: 'edgex-tsc-core@lists.edgexfoundry.org,edgex-tsc-devops@lists.edgexfoundry.org',
    arch: ['amd64', 'arm64']
)