Git Product home page Git Product logo

gradle-cloud-deployer's Introduction

Gradle-Cloud-Deployer

Gradle-Cloud-Deployer

Build Status Codacy Badge codebeat badge codecov Dependency Status Apache License 2

The Gradle-Cloud-Deployer is a gradle plugin which deploys your applications directly into your cloud.

This plugin is available at the Gradle Plugins Portal.

Check out the quick start!

Supported cloud orchestrators

The supported cloud orchestrators and concepts are ...

Marathon

Supported Concepts

  • App
  • Group

Kubernetes

Supported Concepts

  • Deployment
  • Service
  • ReplicationController
  • Pod

Quick start

This quick start demonstrates the usage of the Gradle-Cloud-Deployer plugin.

1. Apply the plugin

Build script snippet for use in all Gradle versions:

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "gradle.plugin.de.qaware.cloud.deployer:deployer:0.9.2"
  }
}

apply plugin: "de.qaware.cloud.deployer"

Build script snippet for new, incubating, plugin mechanism introduced in Gradle 2.1:

plugins {
  id "de.qaware.cloud.deployer" version "0.9.2"
}

To control if you applied the plugin correctly type:

gradlew tasks

You should see the Deployment tasks section in your task list:

Deployment tasks
----------------
delete - Deletes the specified environment (e.g. --environmentId=test).
deleteAll - Deletes all environments.
deploy - Deploys the specified environment (e.g. --environmentId=test).
deployAll - Deploys all environments.

2. Configure the plugin

This build script snippet demonstrates how to configure the plugin to deploy to a Marathon and a Kubernetes cloud:

deployer {
    marathon {
        id = "marathon-zwitscher"
        baseUrl = "http://your-address.com"
        strategy = "REPLACE"
        auth {
            token = defaultToken(file("token.txt"))
        }
        files = [file("marathon-zwitscher-config.json")]
    }
    kubernetes {
        id = "kubernetes-zwitscher"
        baseUrl = "https://your-address.com"
        namespace = "test"
        strategy = "UPDATE"
        auth {
            username = "admin"
            password = "s3cr3t"
        }
        ssl {
            trustAll = true
        }
        files = [file("kubernetes-zwitscher-config.json")]
    }
}

You can define multiple environments. The example creates an marathon-zwitscher and kubernetes-zwitscher environment. Thereby it's possible to mix different cloud orchestrators. Additionally the plugin allows authentication (e.g. via token or username and password) and ssl connections (e.g. via a self-signed certificate).

Examples for a kubernetes config file and a marathon config file can be found in QAware's Cloud Native Zwitscher Showcase.

See the documentation for more details on configuration.

3. Execute a task

After configuring the plugin you can use the different tasks to

  • deploy all environments
gradlew deployAll
  • deploy a single environment
gradlew deploy --environmentId=test
  • delete all environments
gradlew deleteAll
  • delete a single environment
gradlew delete --environmentId=test

See the documentation for more details on the tasks.

Documentation

The wiki contains the documentation for plugin configuration and usage.

Development

For details on building and developing the Gradle-Cloud-Deployer plugin, please see the wiki.

Contributing

Is there anything missing? Do you have ideas for new features or improvements?

All you have to do is to fork this repository, improve the code and issue a pull request.

Maintainer

Simon Jahreiß (@sjahreis)

Sponsor

QAware GmbH

License

This software is provided under the Apache License, Version 2.0 license. See the LICENSE file for details.

gradle-cloud-deployer's People

Contributors

adersberger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

gradle-cloud-deployer's Issues

Rename deploy and deployAll tasks to highlight its purpose

When using the plugin as a part of a continuous delivery pipeline, the name of the tasks can be confusing.
For example the task deployAll could be interpretet as deploying a single unit to a Maven Repository, a docker registry and a runtime enivroment all at once.

Suggestions for new names:

==== deploy
deployToCloud
cloudDeployment

==== deployAll
deployAllToCloud
batchCloudDeployment

Add missing integration tests

Add integration tests for the following topics:

  • Strategy deletion:
  • MarathonReplaceStrategyIntegrationTest.testDelete()
  • KubernetesReplaceStrategyIntegrationTest.testDelete()
  • KubernetesResetStrategyIntegrationTest.testDelete()
  • Strategy update:
  • GroupResourceIntegrationTest.testUpdate()
  • AppResourceIntegrationTest.testUpdate()
  • MarathonUpdateStrategyIntegrationTest
  • KubernetesUpdateStrategyIntegrationTest
  • Deployer (use the test project to test them - should test everything):
  • MarathonDeployer
  • KubernetesDeployer

Add tests for commons module

Add tests for commons module.

  • BaseResourceConfigFactory
  • ContentTreeUtil
  • FileUtil
  • DeployerMessageBundle
  • BasePingResource
  • BaseResourceFactory
  • Blocker
  • ClientFactory
  • ResponseInterpreterUtil
  • BaseDeletionStrategy
  • BaseReplaceStrategy
  • BaseUpdateStrategy
  • BaseDeployer
  • BaseResource

Rename update strategies

Rename the existing update strategies to "RESET" and "REPLACE". Additionally create a "UPDATE" strategy (see #7).

Resource supports no update for Pods and ReplicationControllers

Hi there,

I am trying to deploy into Rancher Kubernetes and receive the following error:

de.qaware.cloud.deployer.commons.error.ResourceException: Resource supports no update (Resource: ReplicationController: /booking-service) (Environment: kub-lab)

Here's my YML:

apiVersion: v1
kind: Service
metadata:
  labels:
    name: my-booking-service
  name: my-booking-service
spec:
  ports:
    - port: 8761
  selector:
    name: booking-service
  type: LoadBalancer
---
apiVersion: v1
kind: ReplicationController
metadata:
  name: booking-service
  labels:
    name: booking-service
spec:
  containers:
    - image: <validImageName>
      name: booking-service
      ports:
        - containerPort: 8761
          name: booking-service

When trying to switch to REPLACE or RESET strategy, I receive a HTTP status code 405 because DELETE seems not to be supported.

So is this an issue with the plugin or more likely with me running kubernetes via rancher?

Optimize plugin

The deployTask should accept the environment as a option. For more details see the seu-as-code credentials plugin.

Make tests executable without a cloud

Use WireMock to mock kubernetes/marathon REST api.

  • kubernetes
  • marathon
  • extract test credentials in setup script which adds them as env-vars
  • separate reports
  • feed reports in sonarqube

Features for further roadmap

Goal: Provide best-in-class developer support for the interface of developers to cluster orchestrators

  • Connector to OpenShift [Prio 1]
  • Connector to Kontena [Prio 3]
  • Connector to Nomad [Prio 3]
  • Integrated syntax and consistency checks for all formats [Prio 1]
  • Linting of decriptors (best practices, pitfalls) [Prio 2]
  • Provide a visualization (e.g. like the OpenShift visualization) [Prio 2]
  • Also provide a Maven plugin [Prio 3]
  • Add blocking feature, which blocks until the container started [Prio 1] (See #50)
  • Remove all code style issues (Sonarqube, Codacy, Codebeat) [Prio 1]

Add option to deployAll to wait until deployment is succeeded

Hi,

is there any way to make the deployAll task run and block until the deployed Pods are up and running? In my case we're trying to use this in a Jenkinsfile as part of an integration test suite and we're running in the problem, that the deployment task finishes too soon and thus the tests fail.

cheers
christian

Check authorization

Check authorization on start and throw an error if authorization is incorrect.

Read ssl certificate from file

The ssl certificate is specified as string right now. But in future a file containing the certificate should be specified

baseURL for Rancher, receive HTTP response 405

Hi,

thanks for the plugin!
I am trying to deploy into a K8s cluster running in a Rancher setup. Basically Rancher gives you a valid kubectl config file. Is the baseURL for your gradle plugin meant to be the "server" url from the kubectl file? For when I use that one I receive a 405 from my k8s server. However deploying my .yml manually via kubectl works fine.

cheers,
Christian

Rename DC/OS tokens

As the tokens have different names than authentication- and api-token, they should be renamed as explained in #16.

Add tests for plugin module

Test the plugin module.

  • DeployerFactory
  • EnvironmentConfigFactory
  • EnvironmentFactory
  • BaseAllEnvironmentsTask
  • BaseSingleEnvironmentTask
  • DeleteAllTask
  • DeleteTask
  • DeployAllTask
  • DeployTask
  • DcosAuthTokenInitializer
  • DefaultTokenInitializer
  • OpenIdConnectTokenInitializer
  • DeployerPlugin

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.