Skipping a step on CircleCI Orb build, version 2.1

435 Views Asked by At

I am using CircleCI CI/CD service. I have a basic build config for Java project with Gradle and Java 1.8. It works fine. Here is the source of my .circleci/config.yml file

executors:
  java1_8:
    docker:
      - image: 'cimg/openjdk:8.0'
orbs:
  gradle: circleci/[email protected]
version: 2.1
workflows:
  checkout-build-test:
    jobs:
      - gradle/test:
          executor: java1_8

After completing the build CircleCI uploads artifacts and this is taking a lot of time. I am looking for a way to skip the "Uploading Artifacts" step.

I can change to CircleCI version 2.0 if needed, but it would be nice to configure 2.1

1

There are 1 best solutions below

0
On

I have found how to skip the step. It turned out to be not very hard.

First, in gradle we can skip steps if we add a -x "step-to-skip" command-line parameters.

Second, CircleCi Gradle Orb can be configured with custom 'test' commands. Here is the documentation: https://circleci.com/developer/orbs/orb/circleci/gradle#jobs-test

I have combined these two features to get a working configuration.

So, if I need to skip 'javaDoc' step, I would modify my CircleCi config.yml file in the following manner:

executors:
  java1_8:
    docker:
      - image: 'cimg/openjdk:8.0'
orbs:
  gradle: circleci/[email protected]
version: 2.1
workflows:
  checkout-build-test:
    jobs:
      - gradle/test:
          test_command: test -x javaDoc
          executor: java1_8