Skip to content

Commit

Permalink
Merge pull request #95 from leopardslab/develop
Browse files Browse the repository at this point in the history
Merge Release v1.2.3 to master
  • Loading branch information
agentmilindu committed Jul 6, 2019
2 parents 1d72b29 + d98a3d5 commit 3038429
Show file tree
Hide file tree
Showing 15 changed files with 792 additions and 95 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ coverage*
.idea/*

snap.login

.DS_Store
25 changes: 16 additions & 9 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ builds:
- amd64
- arm
- arm64

archives:
- replacements:
386: i386
Expand All @@ -30,8 +31,12 @@ changelog:
snapshot:
name_template: "{{.ProjectName}}_{{.Tag}}"

brew:
github:
release:
draft: false
name_template: "{{.ProjectName}} v{{.Version}}"

brews:
- github:
owner: leopardslab
name: homebrew-dunner
folder: Formula
Expand All @@ -44,20 +49,22 @@ nfpm:
name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
homepage: https://github.com/leopardslab/Dunner
description: A Docker based task runner tool
maintainer: LeopardsLab Community
license: MIT
formats:
- deb
- rpm
dependencies:
- git
recommends:
- rpm
snapcraft:
name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'

snapcrafts:
- name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
summary: A Docker based task runner tool
description: |
Dunner is a task runner tool like Grunt but used Docker images like CircleCI do. |
You can define tasks and steps of the tasks in your `.dunner.yaml` file and then run these steps with `Dunner do taskname`
grade: stable
confinement: classic
confinement: strict
base: core18
publish: true
apps:
dunner:
plugs: ["home"]
41 changes: 37 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,71 @@
language: go

go:
- 1.11.x
- master

services:
- docker

env:
global:
- DEP_VERSION="0.5.0"
- PATH=/snap/bin:$PATH
services:
- docker

addons:
apt:
update: true
packages:
- rpm
- snapd

before_install:
- rpmbuild --version
- openssl aes-256-cbc -K $encrypted_12c8071d2874_key -iv $encrypted_12c8071d2874_iv
-in snap.login.enc -out snap.login -d
- curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64
-o $GOPATH/bin/dep
- chmod +x $GOPATH/bin/dep

install:
- make setup
- sudo snap install snapcraft --classic

script:
- make ci

after_success:
- bash <(curl -s https://codecov.io/bash)
- test -n "$TRAVIS_TAG" && snapcraft login --with snap.login

deploy:

- provider: script
skip_cleanup: true
script: curl -sL https://git.io/goreleaser | bash -s -- --rm-dist
verbose: true
on:
tags: true
condition: "$TRAVIS_OS_NAME = linux"
branch: master
go: 1.11.x

- provider: script
skip_cleanup: true
script: bash release/publish_rpm_to_bintray.sh
verbose: true
on:
tags: true
condition: "$TRAVIS_OS_NAME = linux"
branch: master
go: 1.11.x

- provider: script
skip_cleanup: true
script: curl -sL https://git.io/goreleaser | bash
script: bash release/publish_deb_to_bintray.sh
verbose: true
on:
tags: true
condition: "$TRAVIS_OS_NAME = linux"
master: true
branch: master
go: 1.11.x
30 changes: 30 additions & 0 deletions cmd/initialize.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package cmd

import (
"github.com/leopardslab/dunner/internal/logger"
"github.com/leopardslab/dunner/pkg/initialize"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)

func init() {
rootCmd.AddCommand(initCmd)
}

var initCmd = &cobra.Command{
Use: "init",
Short: "Generates a dunner task file `.dunner.yaml`",
Long: "You can initialize any project with dunner task file. It generates a default task file `.dunner.yaml`, you can customize it based on needs. You can override the name of task file using -t flag.",
Run: Initialize,
Args: cobra.NoArgs,
Aliases: []string{"i"},
}

// Initialize command invoked from command line generates a dunner task file with default template
func Initialize(_ *cobra.Command, args []string) {
var dunnerFile = viper.GetString("DunnerTaskFile")
if err := initialize.InitProject(dunnerFile); err != nil {
logger.Log.Fatalf("Failed to initialize project: %s", err.Error())
}
logger.Log.Infof("Dunner task file `%s` created. Please make any required changes.", dunnerFile)
}
11 changes: 6 additions & 5 deletions cmd/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ func init() {
}

var validateCmd = &cobra.Command{
Use: "validate",
Short: "Validate the dunner task file `.dunner.yaml`",
Long: "You can validate task file `.dunner.yaml` with this command to see if there are any parse errors",
Run: Validate,
Args: cobra.MinimumNArgs(0),
Use: "validate",
Short: "Validate the dunner task file `.dunner.yaml`",
Long: "You can validate task file `.dunner.yaml` with this command to see if there are any parse errors",
Run: Validate,
Args: cobra.NoArgs,
Aliases: []string{"v"},
}

// Validate command invoked from command line, validates the dunner task file. If there are errors, it fails with non-zero exit code.
Expand Down
22 changes: 22 additions & 0 deletions internal/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package internal

// DefaultTaskFileContents is the default dunner taskfile contents, used when initialized with dunner
const DefaultTaskFileContents = `# This is an example dunner task file. Please make any required changes.
build:
- name: setup
# Image name that has to be pulled from a registry
image: node:latest
# List of commands that has to be run inside the container
commands:
- ["npm", "--version"]
- ["npm", "install"]
# (Optional) List of directories that are to be mounted on the container
mounts:
- /tmp:/tmp:w
# (Optional) Set any environment variables to be exported in the container
envs:
- PERM=775
`

// DefaultTaskFilePermission is the default file permission of dunner task file
const DefaultTaskFilePermission = 0644
Loading

0 comments on commit 3038429

Please sign in to comment.