-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Chris Dostert
committed
Mar 12, 2018
0 parents
commit 6d614bb
Showing
12 changed files
with
253 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Jetbrains | ||
.idea/ | ||
|
||
# opctl | ||
*args*.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: build | ||
description: builds the package | ||
inputs: | ||
srcDir: | ||
dir: | ||
default: . | ||
outputs: | ||
srcDir: | ||
dir: {} | ||
run: | ||
serial: | ||
- op: | ||
pkg: { ref: test } | ||
inputs: { srcDir } | ||
- op: | ||
pkg: { ref: github.com/opspec-pkgs/_.pkg.bootstrap#1.0.0 } | ||
inputs: | ||
srcDir: | ||
outputs: | ||
srcDir: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM node:9.5.0-alpine | ||
|
||
RUN yarn add js-yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: provision-image | ||
description: | | ||
Provisions image for the pkg w/ name `opspecpkgs/$(opDotYml.name):${opDotYml.version}`. | ||
> Before first use, a Dockerfile MUST be added to `.opspec/provision-image` | ||
inputs: | ||
dockerUsername: | ||
string: | ||
constraints: { minLength: 1 } | ||
description: user for logging in to docker hub | ||
dockerPassword: | ||
string: | ||
constraints: { minLength: 1 } | ||
description: password for logging in to docker hub | ||
isSecret: true | ||
srcDir: | ||
dir: | ||
default: . | ||
run: | ||
serial: | ||
- op: | ||
pkg: { ref: github.com/opspec-pkgs/yaml.parse#1.0.0 } | ||
inputs: { yaml: $(srcDir/op.yml) } | ||
outputs: { opDotYml: result } | ||
- container: | ||
image: { ref: 'alpine:3.6' } | ||
cmd: [sh, -ce, 'echo -n opspecpkgs/${opName#*/*/}:$(opDotYml.version) > /imageName'] | ||
envVars: | ||
opName: $(opDotYml.name) | ||
files: | ||
/imageName: $(imageName) | ||
- op: | ||
pkg: { ref: github.com/opspec-pkgs/docker.image.build#2.0.1 } | ||
inputs: | ||
dockerfile: $(/Dockerfile) | ||
imageName: | ||
outputs: { imageTar } | ||
- op: | ||
pkg: { ref: github.com/opspec-pkgs/docker.image.push#2.0.1 } | ||
inputs: | ||
imageTar: | ||
imageName: | ||
username: $(dockerUsername) | ||
password: $(dockerPassword) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: release | ||
description: releases the package | ||
inputs: | ||
githubUsername: | ||
string: | ||
constraints: { minLength: 1 } | ||
description: user for logging in to github | ||
githubPassword: | ||
string: | ||
constraints: { minLength: 1 } | ||
description: password for logging in to github | ||
isSecret: true | ||
srcDir: | ||
dir: | ||
default: . | ||
outputs: | ||
srcDir: | ||
dir: {} | ||
run: | ||
serial: | ||
- op: | ||
pkg: { ref: build } | ||
inputs: | ||
srcDir: | ||
outputs: | ||
srcDir: | ||
- op: | ||
pkg: { ref: github.com/opspec-pkgs/yaml.parse#1.0.0 } | ||
inputs: { yaml: $(srcDir/op.yml) } | ||
outputs: { opDotYml: result } | ||
- op: | ||
pkg: { ref: github.com/opspec-pkgs/git.resolve-commit#1.0.2 } | ||
inputs: { dotGitDir: $(srcDir/.git) } | ||
outputs: { commit: } | ||
- container: | ||
image: { ref: 'alpine:3.6' } | ||
cmd: [sh, -ce, 'echo -n ${opName#*/*/} > /opRepo'] | ||
envVars: | ||
opName: $(opDotYml.name) | ||
files: | ||
/opRepo: $(opRepo) | ||
- op: | ||
pkg: { ref: github.com/opspec-pkgs/github.release.create#1.0.0 } | ||
inputs: | ||
owner: opspec-pkgs | ||
repo: $(opRepo) | ||
loginUsername: $(githubUsername) | ||
loginPassword: $(githubPassword) | ||
tag: $(opDotYml.version) | ||
commitish: $(commit) | ||
name: $(opDotYml.version) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: test | ||
description: tests the package | ||
inputs: | ||
srcDir: | ||
dir: | ||
default: . | ||
run: | ||
op: | ||
pkg: { ref: github.com/opspec-pkgs/opspec.pkg.validate#1.0.0 } | ||
inputs: { pkg: $(srcDir) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
language: generic | ||
sudo: required | ||
before_script: | ||
- curl -L https://bin.equinox.io/c/4fmGop7rntx/opctl-beta-linux-amd64.tgz | sudo tar -xzv -C /usr/local/bin | ||
services: | ||
- docker | ||
script: | ||
- opctl run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Change Log | ||
|
||
All notable changes will be documented in this file in accordance with | ||
[![keepachangelog 1.0.0](https://img.shields.io/badge/keepachangelog-1.0.0-brightgreen.svg)](http://keepachangelog.com/en/1.0.0/) | ||
|
||
## \[Unreleased] | ||
|
||
## \[1.0.0] 2018-03-11 |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @opspec-pkgs/maintainers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
[![Build Status](https://travis-ci.org/opspec-pkgs/opspec.dir.list-ops.svg?branch=master)](https://travis-ci.org/opspec-pkgs/opspec.dir.list-ops) | ||
|
||
# Problem statement | ||
|
||
lists ops in a directory | ||
|
||
# Format | ||
|
||
this version of the pkg is in [![opspec 0.1.5](https://img.shields.io/badge/opspec-0.1.5-brightgreen.svg?colorA=6b6b6b&colorB=fc16be)](https://opspec.io/0.1.5/packages.html) format | ||
|
||
# Example usage | ||
|
||
## Install | ||
|
||
```shell | ||
opctl pkg install github.com/opspec-pkgs/opspec.dir.list-ops#1.0.0 | ||
``` | ||
|
||
## Run | ||
|
||
``` | ||
opctl run github.com/opspec-pkgs/opspec.dir.list-ops#1.0.0 | ||
``` | ||
|
||
## Compose | ||
|
||
```yaml | ||
op: | ||
pkg: { ref: github.com/opspec-pkgs/opspec.dir.list-ops#1.0.0 } | ||
inputs: | ||
# params w/ default | ||
dir: | ||
outputs: | ||
ops: | ||
``` | ||
# Support | ||
join us on | ||
[![Slack](https://opspec-slackin.herokuapp.com/badge.svg)](https://opspec-slackin.herokuapp.com/) | ||
or | ||
[open an issue](https://github.com/opspec-pkgs/opspec.dir.list-ops/issues) | ||
# Releases | ||
releases are versioned according to | ||
[![semver 2.0.0](https://img.shields.io/badge/semver-2.0.0-brightgreen.svg)](http://semver.org/spec/v2.0.0.html) | ||
and [tagged](https://git-scm.com/book/en/v2/Git-Basics-Tagging); see | ||
[CHANGELOG.md](CHANGELOG.md) for release notes | ||
# Contributing | ||
see | ||
[project/CONTRIBUTING.md](https://github.com/opspec-pkgs/project/blob/master/CONTRIBUTING.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const jsYaml = require('js-yaml'); | ||
const PATH_PREFIX = '/dir/'; | ||
|
||
const listOps = dir => | ||
fs.readdirSync(dir) | ||
.reduce((files, file) => { | ||
if (fs.statSync(path.join(dir, file)).isDirectory()) { | ||
files.push(...listOps(path.join(dir, file))) | ||
} else if(file === 'op.yml') { | ||
const opYmlPath = path.join(dir, file); | ||
const op = jsYaml.safeLoad(fs.readFileSync(opYmlPath)) | ||
files.push({ | ||
path: opYmlPath.slice(PATH_PREFIX.length), | ||
name: op.name, | ||
}); | ||
} | ||
return files; | ||
}, | ||
[]); | ||
|
||
fs.writeFileSync('/ops', JSON.stringify(listOps(PATH_PREFIX))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: github.com/opspec-pkgs/opspec.dir.list-ops | ||
description: lists ops in a directory | ||
inputs: | ||
dir: | ||
dir: | ||
description: directory to (recursively) list ops from | ||
default: . | ||
outputs: | ||
ops: | ||
array: | ||
description: lists name & path of ops in the directory | ||
constraints: | ||
items: | ||
properties: | ||
name: {} | ||
path: {} | ||
version: 1.0.0 | ||
run: | ||
container: | ||
image: { ref: 'opspecpkgs/opspec.dir.list-ops:1.0.0' } | ||
cmd: [node, /cmd.js] | ||
dirs: | ||
/dir: $(dir) | ||
files: | ||
/cmd.js: | ||
/ops: $(ops) |