Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
f8cc775
Initial commit
emedvedev Nov 11, 2016
d459ed4
Update README.md
emedvedev Nov 11, 2016
89cbcc0
Update README.md
emedvedev Nov 11, 2016
9cb07fd
Update README.md
emedvedev Nov 11, 2016
6a43517
Update README.md
emedvedev Nov 11, 2016
929fd91
Add contribution license agreement.
Dec 3, 2016
97892ee
remove lib/ from .gitignore
nullkarma Apr 26, 2017
82cca02
Foreman Integration Pack
nullkarma Apr 26, 2017
64b047b
pep8 applied
nullkarma Apr 28, 2017
ba3a32f
Merge pull request #23 from nullkarma/foreman
LindsayHill Apr 29, 2017
3c9ef49
Revert "Foreman Integration Pack"
LindsayHill Apr 29, 2017
39a5334
Merge pull request #26 from StackStorm-Exchange/revert-23-foreman
LindsayHill Apr 29, 2017
fac2d65
Make lib exclusion more specific
LindsayHill Jun 21, 2017
a5e3137
Merge pull request #33 from StackStorm-Exchange/LH/gitignore
LindsayHill Jun 21, 2017
e2e06eb
Remove git submodule reference
LindsayHill Aug 3, 2017
b6c5af1
Add circle ci config.
Kami Oct 25, 2018
6be721b
Add dummy pack to test build process.
Kami Oct 25, 2018
1dfb04c
Remove deploy step.
Kami Oct 25, 2018
1b6d6c9
Don't build master branch.
Kami Oct 25, 2018
d6555a0
Add a step which prepares the repo for CI.
Kami Oct 25, 2018
3ff1b18
Fix syntax error.
Kami Oct 25, 2018
1f0f2bc
Fix syntax error.
Kami Oct 25, 2018
ad16639
Simplify circle ci config.
Kami Oct 25, 2018
01bd067
Fix syntax.
Kami Oct 25, 2018
35c7e07
Remove config to get rid of build triggered twice issue:
Kami Oct 25, 2018
23fff83
Revert "Remove config to get rid of build triggered twice issue:"
Kami Oct 25, 2018
e596d19
Print contents of the current directory.
Kami Oct 25, 2018
49ccb8f
Force check all the files.
Kami Oct 25, 2018
c3a5690
Set FORCE_CHECK_ALL_FILES env varible.
Kami Oct 25, 2018
0f5e99e
Dummy isssue to test the build.
Kami Oct 25, 2018
fc54d34
Revert "Dummy isssue to test the build."
Kami Oct 25, 2018
7ce31af
Test lint build failure.
Kami Oct 25, 2018
bf15180
Remove test pack.
Kami Oct 25, 2018
9a51620
Merge pull request #132 from StackStorm-Exchange/build_checks
Kami Oct 25, 2018
b3e67e8
Update Circle CI config to check submodules.
Kami Oct 25, 2018
705632e
Add test submodule.
Kami Oct 25, 2018
3d0c92a
Remove test submodule.
Kami Oct 25, 2018
ef84145
Merge pull request #134 from StackStorm-Exchange/checkout_submodules
Kami Oct 25, 2018
58046ff
added nexus3
Feb 22, 2019
dade6a2
added tests
Feb 23, 2019
c7557af
flake8 passed
Feb 23, 2019
f78a139
removed extra space
Feb 23, 2019
bff80d2
fixed json files
Feb 23, 2019
a593d5e
removed yaml shorthand
Feb 23, 2019
d19cabb
updated README
Feb 26, 2019
3c73b4c
Transfer the the pack from StackStorm-Exchange/incubator
blag Feb 27, 2019
0e87ca4
Fix incorrect moved directory
blag Feb 27, 2019
0f00d6e
Don't echo that we're going to echo, just echo
blag Feb 27, 2019
b9bef17
Make sure we use the mock object in the action
blag Feb 27, 2019
358c5f4
Split up tests and tweak assertions to work
blag Feb 27, 2019
72e25cf
Add comment and finish up description
blag Feb 27, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .gitmodules
Empty file.
31 changes: 31 additions & 0 deletions .scripts/prepare-repo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

PACK_DIRECTORY=$(find . -maxdepth 1 -type d -not -path '*/\.*' -not -path '\.' | head -1 | sed -e 's/^\.\///')

if [[ -z "${PACK_DIRECTORY}" ]]; then
echo "Unable to find pack directory"
exit 1
fi

echo "Found pack directory: ${PACK_DIRECTORY}"

PACK_NAME=$(cat ${PACK_DIRECTORY}/pack.yaml | grep "name:" | sed -e 's/^name:[ \t]*//')

if [[ -z "${PACK_NAME}" ]]; then
echo "Unable to retrieve pack name from ${PACK_DIRECTORY}/pack.yaml"
exit 1
fi

echo "Found pack name: ${PACK_NAME}"


# Copy pack files in root dir so the checks work
echo "Exporting PACK_NAME and removing pack directory"

cp -r ${PACK_DIRECTORY}/* .
rm -rf ${PACK_DIRECTORY}

ls -la .

echo "export PACK_NAME=$PACK_NAME" >> ~/.circlerc
echo "export FORCE_CHECK_ALL_FILES=true" >> ~/.circlerc
90 changes: 90 additions & 0 deletions .yo-rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"generator-st2pack": {
"promptValues": {
"features": [
"Sensors",
"Rules",
"Policies",
"Aliases"
],
"pack_ref": "nexus3",
"pack_name": "Sontatype Nexus3",
"pack_desc": "Sontatype nexus3 stackstorm pack"
},
"actions": {},
"aliases": {
"greet": {
"name": "greet",
"pack": "nexus3",
"description": "Greet StackStorm",
"action_ref": "nexus3.greet",
"formats": [
"greet {{greeting}}"
]
}
},
"rules": {
"on_hello_event1": {
"name": "on_hello_event1",
"pack": "nexus3",
"description": "Sample rule firing on nexus3.event1.",
"enabled": true,
"trigger": {
"type": "nexus3.event1"
},
"action": {
"ref": "nexus3.greet",
"parameters": {
"greeting": "Yo"
}
}
}
},
"sensors": {
"HelloSensor": {
"class_name": "HelloSensor",
"entry_point": "sensor1.py",
"description": "Test sensor that emits triggers.",
"trigger_types": [
{
"name": "event1",
"description": "An example trigger.",
"payload_schema": {
"type": "object"
}
}
]
}
},
"policies": {
"http.retry": {
"name": "http.retry",
"description": "Retry core.http action on timeout.",
"enabled": true,
"resource_ref": "core.http",
"policy_type": "action.retry",
"parameters": {
"retry_on": "timeout",
"max_retry_count": 2,
"delay": 2
}
},
"greet.concurrency": {
"name": "greet.concurrency",
"pack": "nexus3",
"description": "Limits the concurrent executions of the greet action.",
"enabled": true,
"resource_ref": "nexus3.greet",
"policy_type": "action.concurrency",
"parameters": {
"threshold": 10
}
}
},
"pack": {
"ref": "nexus3",
"name": "Sontatype Nexus3",
"description": "Sontatype nexus3 stackstorm pack"
}
}
}
106 changes: 106 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Stackstorm-Nexus3

[Sontatype nexus3](https://www.sonatype.com/nexus-repository-oss) stackstorm pack

## Installation

Install this pack with: `st2 pack install file://$PWD`

Or if in remote repository: `st2 pack install https://github.com/MY/PACK`

## Configuration

Copy the example configuration in [nexus3.yaml.example](./nexus3.yaml.example)
to `/opt/stackstorm/configs/nexus3.yaml` and edit as required.

add nexus3 server connection profile:

* ``url`` - URL of the nexus3 server (e.g. ``http://localhost:8081``)
* ``user`` - username
* ``password`` - Password
* ``verify`` - https tls verify, only used if the `url` option specifies an `https` connection

You can also add multiple profiles:

When you add multiple profile, above parameters becomes defaults for any key missing in the profile.

``` yaml
---
url: "http://localhost:8081"
user: "admin"
password: "admin123"
verify: True
default_profile: "dev" # use this to make for missing config_profile parameter when calling any action
profiles:
"dev":
url: "http://localhost:8081"
user: "dev-user"
password: "mypas"
verify: True
"dev-2":
user: "dev2-user"
password: "mypass2"
# url : fallback to url: "http://localhost:8081"
# verify: fallback to verify: True
```

**Note** : When modifying the configuration in `/opt/stackstorm/configs/` please
remember to tell StackStorm to load these new values by running
`st2ctl reload --register-configs`

## Actions

While naming actions following convention is used:

< VERB >_< RESOURCE(plural) >
eg.
list_repositories
get_scripts

Supported Resources

* Repositories
* Scripts

### Available actions

* **list_repositories** : List nexus3 repositories
* **get_repositories** : get nexus3 repositories
* **create_repositories** : create nexus3 repository
* **delete_repositories** : delete nexus3 repository

* **list_scripts** : List nexus3 scripts
* **get_scripts** : get nexus3 scripts
* **create_scripts** : create(& upload) if missing, groovy script
* **delete_scripts** : delete nexus3 script

## Policies

* **http.retry** : Retry core.http action on timeout.

## Aliases

--NIL--

## Rules

--NIL--

## Sensors

--NIL--

## Testing

While testing you can leverage [Makefile](./tests/Makefile) to ease writing and testing actions. Read the Makefile for the list of useful commands.

## Contributing

Before submitting make sure python linter is happy with your changes first

``` bash
pip install flake8

#executing flake8 ./
make -f tests/Makefile lint
```
77 changes: 77 additions & 0 deletions actions/create_repositories.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
name: create_repositories
runner_type: python-script
description: Create a repository
enabled: true
entry_point: run.py
parameters:
action:
default: create_repositories
immutable: true
type: string
config_profile:
type: string
description: Select which nexus config profile to use.
required: false
name:
type: string
description: A unique identifier for this repository
required: true
format:
type: string
description: The format of the repository (i.e. maven2, docker, raw, nuget...)
required: true
enum:
- bower
- docker
- gitlfs
- maven
- npm
- nuget
- pypi
- raw
- rubygems
- yum
type:
type: string
description: The type of repository (i.e. group, hosted, or proxy)
required: true
enum:
- hosted
- proxy
version_policy:
type: string
description: What type of artifacts does this repository store?
required: false
default: RELEASE
enum:
- RELEASE
- SNAPSHOT
- MIXED
layout_policy:
type: string
description: Validate that all paths are maven artifact or metadata paths
required: false
default: STRICT
enum:
- STRICT
- PERMISSIVE
blob_store_name:
type: string
description: Blob store used to store asset contents
required: true
default: "default"
strict_content_type_validation:
type: boolean
description: Validate that all content uploaded to this repository is of a MIME type appropriate for the repository format
required: true
default: false
write_policy:
type: string
description: Controls if deployments of and updates to artifacts are allowed
required: true
default: ALLOW
enum:
- ALLOW_ONCE
- ALLOW
- DENY
19 changes: 19 additions & 0 deletions actions/create_scripts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: create_scripts
runner_type: python-script
description: create a script
enabled: true
entry_point: run.py
parameters:
action:
default: create_scripts
immutable: true
type: string
config_profile:
type: string
description: Select which nexus config profile to use.
required: false
data:
type: object
description: instance of script to be created.
required: false
19 changes: 19 additions & 0 deletions actions/delete_repositories.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: delete_repositories
runner_type: python-script
description: delete all repositories of nexus3
enabled: true
entry_point: run.py
parameters:
action:
default: delete_repositories
immutable: true
type: string
config_profile:
type: string
description: Select which nexus config profile to use.
required: false
name:
type: string
description: A unique identifier of the repository to delete
required: true
19 changes: 19 additions & 0 deletions actions/delete_scripts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: delete_scripts
runner_type: python-script
description: delete a script
enabled: true
entry_point: run.py
parameters:
action:
default: delete_scripts
immutable: true
type: string
config_profile:
type: string
description: Select which nexus config profile to use.
required: false
name:
type: string
description: name of script to be deleted
required: true
19 changes: 19 additions & 0 deletions actions/get_repositories.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: get_repositories
runner_type: python-script
description: get repository identified by a unique identifier
enabled: true
entry_point: run.py
parameters:
action:
default: get_repositories
immutable: true
type: string
config_profile:
type: string
description: Select which nexus config profile to use.
required: false
name:
type: string
description: A unique identifier of the repository to fetch
required: true
Loading