Coder Social home page Coder Social logo

concourse-nomad-resource's Introduction

Nomad Job Concourse Resource

A concurse resource for jobs on Hashicorp Nomad.

Source Configuration

resource_types:
  - name: nomad
    type: registry-image
    source:
      repository: cioplenu/concourse-nomad-resource
      tag: latest

resources:
  - name: test-job
    type: nomad
    source:
      url: http://nomad-cluster.local:4646
      name: test
      token: XXXX
  • url: (required) URL of the nomad api on a node of your cluster
  • name: (required) name of the job
  • token: Nomad ACL token

Behavior

check: Check for new versions of the job

Checks if there are new versions of the job. It uses the nomad job history command of the nomad CLI and not all versions since the first deployment might be available.

in: noop

out: Run a new version of the job

Deploys a new version of the job to the cluster using nomad job run by reading a HCL job file. Golang template variables can be used to insert information like a version on the fly.

Parameters

  • job_path: (required) Path of the HCL job file to run
  • vars: { [key: string]: string } dictionary of variables to substitute in the job file. Each key should be represented in the job file as {{.key}}
  • var_files: { [key: string]: string } dictionary of paths to files to read to get variable values. Each key should be represented in the job file as {{.key}} and the values should be path to text files which content will be used as the variable value. Whitespace and trailing newlines will be trimmed from the value.

Example

resource_types:
  - name: nomad
    type: registry-image
    source:
      repository: cioplenu/concourse-nomad-resource
      tag: latest

resources:
  - name: sample-job
    type: nomad
    source:
      url: http://10.4.0.4:4646
      name: sample
      token: ((nomad-cluster-token))

  - name: sample-repo
    type: git
    source:
      uri: [email protected]:cioplenu/sample.git
      branch: main
      private_key: ((private-repo-key))

jobs:
  - name: deploy
    plan:
      - get: sample-repo
      - put: sample-job
        params:
          job_path: sample-repo/sample.nomad
          vars:
            registry_token: ((registry-token))
          var_files:
            version: sample-repo/ci/version

with a job file like:

job "sample" {
  region      = "de"
  datacenters = ["dc1"]
  type        = "service"

  group "sample" {
    task "sample" {
      driver = "docker"

      config {
        image = "cioplenu/sample:{{.version}}"
        auth  = {
          username = "some-username"
          password = "{{.registry_token}}"
        }
        force_pull = true
      }

      resources {
        cpu    = 50
        memory = 50
        network {
          mbits = 1
        }
      }
    }
  }
}

and a version file like:

9.1.4

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.