resource

package module
v0.0.0-...-c20ee3f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2020 License: MIT Imports: 3 Imported by: 0

README

Date Time Version Resource

Implements a Concourse CI resource type to generate a date time version to be used in your pipeline.

Source Configuration

  • timezone: Optional. The Timezone in which you want the date generated. Default is UTC.

  • format: Optional. The Format of the output Date Time version, it uses the Go Time Format. Default is 20060102-150405.

Behavior

check: None.
in: Generates a version file containing the Date Time Version.
Parameters

None.

out: Generates a Date Time version in the Timezone and Format defined.
Parameters

None.

Example

---
resource_types:
- name: datetime-version
  type: registry-image
  source:
    repository: dcsg/datetime-version-resource

resources:
- name: datetime-version
  type: datetime-version
  source:
    timezone: 'Europe/Lisbon' # default is 'UTC'
    format: '20060102.150405' # default is '20060102-150405'

- name: master-code
  type: git
  icon: git
  source:
    uri: https://github.com/dcsg/datetime-version-resource.git
    branch: master

jobs:
  - name: notify-bugsnag
    plan:
      - put: datetime-version
      - put: master-code
        params:
          // other git config params
          tag: datetime-version/version
          only_tag: true

Development

Prerequisites
  • golang is required - version 1.14.x is tested; earlier versions may also work.
  • docker is required - version 19.03.x is tested; earlier versions may also work.
Running the tests

The tests have been embedded with the Dockerfile; ensuring that the testing environment is consistent across any docker enabled platform. When the docker image builds, the test are run inside the docker container, on failure they will stop the build.

Run the tests with the following command:

docker build -t datetime-version-resource -f dockerfiles/Dockerfile .
Contributing

Please make all pull requests to the master branch.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SourceDefaults = Source{
	Timezone: "UTC",
	Format:   "20060102-150405",
}

Functions

func VersionGenerator

func VersionGenerator(c clock.Clock, timezone string, layout string) (string, error)

Types

type CheckRequest

type CheckRequest struct {
	Source  Source  `json:"source"`
	Version Version `json:"version"`
}

type InRequest

type InRequest struct {
	Source  Source  `json:"source"`
	Version Version `json:"version"`
}

type InResponse

type InResponse struct {
	Version  Version    `json:"version"`
	Metadata []Metadata `json:"metadata"`
}

type Metadata

type Metadata struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type OutRequest

type OutRequest struct {
	Source Source `json:"source"`
}

type OutResponse

type OutResponse struct {
	Version  Version    `json:"version"`
	Metadata []Metadata `json:"metadata"`
}

type Source

type Source struct {
	Timezone string `json:"timezone,omitempty"`
	Format   string `json:"format,omitempty"`
}

type Version

type Version struct {
	Version string `json:"version"`
}

Directories

Path Synopsis
cmd
check command
in command
out command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL