Giter VIP home page Giter VIP logo

gradle-sora-plugin's Introduction

Build Status

gradle-devops-helper

Min supported gradle 4.8 Works with gradle 7

Usage

https://plugins.gradle.org/plugin/jp.co.soramitsu.sora-plugin

Tasks

Task name Tasks executed Description
build compile + build Builds, does NOT execute check or test.
check build + test + check Builds, then executes static code analyzers
test build + test Builds, then executes all registered tests
coverage build + test + coverage Builds, executes tests and then collects code coverage.
printOsInfo printOsInfo Prints information about OS and project
printVersion printVersion Prints project version based on git
printConfig printConfig Prints plugin configuration
printDockerImage printDockerImage Prints Docker Image that will be used in dockerPush
dockerVersion dockerVersion Prints current docker version
dockerClean dockerClean Cleans docker build context (build/docker)
dockerfileCreate dockerClean + dockerfileCreate Generates Dockerfile in build context
dockerCopyJar build + dockerCopyJar Builds and copies JAR to build context
dockerCopyFiles dockerCopyFiles Copies custom files specified to build context
dockerBuild dockerfileCreate + dockerCopyJar + dockerCopyFiles Builds image with autogenerated tag
dockerPush dockerBuild + dockerPush Pushes image to docker registry

NOTE:

  • to enable docker* tasks, please apply plugin application
  • build, test, check tasks will be modified ONLY if java plugin is applied

Configuration

All fields are optional.

build.gradle:

soramitsu {
  projectGroup = 'sora' # define namespace for your project. default: null
  docker {
    # base docker image to be used (Dockerfile FROM instruction)
    # default: detected based on java version. fallback: openjdk:8-jre-alpine
    baseImage = 'openjdk:8u191-jre-alpine'
    # path to output JAR which is going to be dockerized
    jar = new File("build/libs/${project.name}-${project.version}.jar") 
    # manually specified docker tag. if null, automatic versioning based on git is used 
    # it replaces only 'version' part, e.g. ${name}:${tag}. Example: soramitsu/example:${tag}
    tag = "custom-tag"  
    # to enable dockerPush task, define registry credentials
    registry {
      url = 'https://<host>:<port>' 
      username = '<username>'
      password = '<password>'
      email = '<email>'  # optional
    }
    # files that will be added to the docker image (optional)
    # host fs: docker image fs
    files = [local-file.txt: /file.txt]
    # optional startup arguments for java
    # java -jar ... $args
    runArgs = "-version"
    # optional build arguments for docker
    buildArgs = ['--platform':'linux/amd64']
  }
}

Docker registry data can be defined from env vars. Env vars ALWAYS override any value from build.gradle:

DOCKER_REGISTRY_URL="https://<host>:<port>"
DOCKER_REGISTRY_USERNAME="<username>"
DOCKER_REGISTRY_PASSWORD="<password>"
DOCKER_REGISTRY_EMAIL="<email>"

Features

  • automatic versioning based on git (uses gitVersion)
  • build does not invoke tests (only with plugin java)
  • separate check task for static code analysis; formatting analysis
  • coverage task, which invokes all tests and calculates coverage.
  • dockerBuild task to build docker image including custom arguments
  • automatic tag generation. Tag consists of ${url}/${projectGroup}/${project.name}:${project.version}
    • url - url of docker registry without http(s)://
    • projectGroup - e.g. sora, bakong, etc.
    • project.name - defined in settings.gradle
    • project.version - git version
  • configuration of docker registry from env vars

Examples

See projects directory.

gradle-sora-plugin's People

Contributors

warchant avatar yurivin avatar mingela avatar arndey avatar bulatsaif avatar dolgopolovwork avatar wpi86 avatar antonktrue avatar bbr88 avatar theosotr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.