Java (With Gradle)
Example Java (With Gradle) Pipeline
Example Yaml configuration for a project building a Java application with Gradle.
Scenario
User is looking to create a pipeline that builds an artifact on any event or branch pushed to source control.
Steps
The following pipeline concepts are being used in the pipeline below:
Note:
Pipeline must be stored in base of repository as .vela.yml
or .vela.yaml
It is recommended to pin image:
versions for production pipelines
version: "1"
steps:
- name: install
image: gradle:latest
pull: always
environment:
GRADLE_USER_HOME: .gradle
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false
commands:
- gradle downloadDependencies
- name: test
image: gradle:latest
pull: always
environment:
GRADLE_USER_HOME: .gradle
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false
commands:
- gradle test
- name: build
image: gradle:latest
pull: always
environment:
GRADLE_USER_HOME: .gradle
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false
commands:
- gradle build
Stages
The following pipeline concepts are being used in the pipeline below:
Note:
Pipeline must be stored in base of repository as .vela.yml
or .vela.yaml
It is recommended to pin image:
versions for production pipelines
version: "1"
stages:
install:
steps:
- name: install
image: gradle:latest
pull: always
environment:
GRADLE_USER_HOME: .gradle
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false
commands:
- gradle downloadDependencies
test:
needs: [ install ]
steps:
- name: test
image: gradle:latest
pull: always
environment:
GRADLE_USER_HOME: .gradle
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false
commands:
- gradle test
build:
needs: [ install ]
steps:
- name: build
image: gradle:latest
pull: always
environment:
GRADLE_USER_HOME: .gradle
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.workers.max=1 -Dorg.gradle.parallel=false
commands:
- gradle build
Last modified June 3, 2021: refactor: replace concepts with tour (#207) (aa0aceac)