Skip to content

Commit 7fab38f

Browse files
authored
Add Port (getport.io) workflow templates (#471)
* Begin working on codefresh action for port * Initial commit of working version * Small update to README * Update package.json * Add credentials file and explanation * Fix CR comments * Add version 1.1.0
1 parent b0ee913 commit 7fab38f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+16317
-0
lines changed

workflows/port/CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Changelog
2+
3+
## v1.0.0 (21.12.2022)
4+
5+
### entity-get
6+
7+
Initial commit
8+
9+
### entity-upsert
10+
11+
Initial commit
12+
13+
## v1.1.0 (8.02.2022)
14+
15+
### entity-upsert
16+
17+
Add support for team array

workflows/port/assets/icon.svg

Lines changed: 19 additions & 0 deletions
Loading
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Starting-Template
2+
3+
## Summary
4+
5+
A set of templates to perform operations against [Port](https://getport.io) such as getting an existing Entity or creating/updating an Entity as part of your CI/CD.
6+
7+
## Templates
8+
9+
1. [entity-get](https://github.com/codefresh-io/argo-hub/blob/main/workflows/port/versions/1.0.0/docs/entity-get.md)
10+
2. [entity-upsert](https://github.com/codefresh-io/argo-hub/blob/main/workflows/port/versions/1.0.0/docs/entity-upsert.md)
11+
12+
## Secrets
13+
14+
In order to use the workflow templates, you will need to store the `PORT_CLIENT_ID` and `PORT_CLIENT_SECRET` as secrets in your cluster, you can follow the example shown in the [portCredentials.yml](https://github.com/codefresh-io/argo-hub/blob/main/workflows/port/versions/1.0.0/portCredentials.yaml) file for reference.
15+
16+
Note: if you use the exact same format specified in the portCredentials.yml file, you don't need to provide the secret name and id and secret key names when using the workflow template, as the format in the file matches the defaults picked up by the template inputs.
17+
18+
## Security
19+
20+
Minimal required permissions
21+
22+
[Full rbac permissions list](https://github.com/codefresh-io/argo-hub/blob/main/workflows/port/versions/1.0.0/rbac.yaml)
23+
24+
## Complete docs
25+
26+
For more information and examples, take a look at our [documentation](https://docs.getport.io/build-your-software-catalog/sync-data-to-catalog/ci-cd/codefresh-workflow-template/)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# entity-get
2+
3+
## Summary
4+
5+
The `get-entity` template gets an existing Port Entity as part of the workflow, and exposes its values as outputs for later workflow steps.
6+
7+
## Inputs/Outputs
8+
9+
### Inputs
10+
11+
- `PORT_CREDENTIALS_SECRET` - name of the secret to get the `CLIENT_ID` and `CLIENT_SECRET` from (default: `port-credentials`)
12+
- `PORT_CLIENT_ID_KEY` - key in the secret where the base64 encoded `PORT_CLIENT_ID` is stored (default: `PORT_CLIENT_ID`);
13+
- `PORT_CLIENT_SECRET_KEY` - key in the secret where the base64 encoded `PORT_CLIENT_SECRET` is stored (default `PORT_CLIENT_SECRET`);
14+
- `BLUEPRINT_IDENTIFIER` - identifier of the blueprint the target entity is from;
15+
- `ENTITY_IDENTIFIER` - identifier of the target entity.
16+
17+
### Outputs
18+
19+
- `PORT_COMPLETE_ENTITY` - complete entity JSON;
20+
- `PORT_BLUEPRINT_IDENTIFIER` - identifier of the blueprint the target entity is from;
21+
- `PORT_ENTITY_IDENTIFIER` - identifier of the target entity;
22+
- `PORT_ENTITY_TITLE` - title of the entity;
23+
- `PORT_ENTITY_PROPERTIES` - all properties of the entity in JSON format;
24+
- `PORT_ENTITY_RELATIONS` - all relations of the entity in JSON format;
25+
26+
## Examples
27+
28+
### entity-get Example
29+
30+
```yaml
31+
- name: entity-get
32+
templateRef:
33+
name: port
34+
template: entity-get
35+
arguments:
36+
parameters:
37+
- name: PORT_CREDENTIALS_SECRET
38+
value: "port-credentials"
39+
- name: PORT_CLIENT_ID_KEY
40+
value: "PORT_CLIENT_ID"
41+
- name: PORT_CLIENT_SECRET_KEY
42+
value: "PORT_CLIENT_SECRET"
43+
- name: BLUEPRINT_IDENTIFIER
44+
value: "microservice" # Replace with your target blueprint identifier
45+
- name: ENTITY_IDENTIFIER
46+
value: "morp" # Replace with your target entity identifier
47+
```
48+
49+
To access the workflow outputs, use `{{workflow.outputs.parameters.[OUTPUT_PARAM]}}`
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# entity-upsert
2+
3+
## Summary
4+
5+
The `upsert-entity` template creates or updates an entity with the identifier matching the one provided.
6+
7+
## Inputs/Outputs
8+
9+
### Inputs
10+
11+
- `PORT_CREDENTIALS_SECRET` - name of the secret to get the `CLIENT_ID` and `CLIENT_SECRET` from (default: `port-credentials`)
12+
- `PORT_CLIENT_ID_KEY` - key in the secret where the base64 encoded `PORT_CLIENT_ID` is stored (default: `PORT_CLIENT_ID`);
13+
- `PORT_CLIENT_SECRET_KEY` - key in the secret where the base64 encoded `PORT_CLIENT_SECRET` is stored (default `PORT_CLIENT_SECRET`);
14+
- `BLUEPRINT_IDENTIFIER` - identifier of the blueprint to create an entity of (this is a **required** parameter);
15+
- `ENTITY_IDENTIFIER` - identifier of the new (or existing) entity. Leave empty to get an auto-generated identifier (default: `null`, Port will auto generate an identifier for this entity);
16+
- `ENTITY_TITLE` - Title of the new (or existing) entity (default: `null`, Port will create an entity without a title);
17+
- `ENTITY_TEAM` - Team of the new (or existing) entity (default: `null`, Port will create an entity without a team);
18+
- `ENTITY_ICON` - Icon of the new (or existing) entity (default: `null`, Port will create an entity with the default blueprint icon);
19+
- `ENTITY_PROPERTIES` - Properties of the new (or existing) entity (default: `null`, Port will create an entity with empty properties);
20+
- `ENTITY_RELATIONS` - Relations of the new (or existing) entity (default: `null`, Port will create an entity without relations).
21+
22+
### Outputs
23+
24+
- `ENTITY_IDENTIFIER` - identifier of the new (or existing) entity.
25+
26+
## Examples
27+
28+
### entity-upsert Example
29+
30+
```yaml
31+
- name: entity-upsert
32+
templateRef:
33+
name: port
34+
template: entity-upsert
35+
arguments:
36+
parameters:
37+
# If you save the CLIENT_ID and CLIENT_SECRET in the same format shown in the portCredentials.yml file, there is no need to provide PORT_CREDENTIALS_SECRET, PORT_CLIENT_ID_KEY, PORT_CLIENT_SECRET_KEY
38+
- name: BLUEPRINT_IDENTIFIER
39+
value: "microservice"
40+
- name: ENTITY_IDENTIFIER
41+
value: "morp"
42+
- name: ENTITY_TITLE
43+
value: "Morp-Argo"
44+
- name: ENTITY_PROPERTIES
45+
value: |
46+
{
47+
"region": "eu-west-4"
48+
}
49+
```
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
**/node_modules
2+
.yarn/*
3+
!.yarn/releases
4+
!.yarn/plugins
5+
**/.dockerignore
6+
**/.git
7+
**/.DS_Store
8+
**/.vscode
9+
**/README.md
10+
**/LICENSE
11+
**/npm-debug.log
12+
**/.env.*.local
13+
**/.editorconfig
14+
**/dist
15+
**/*.pem
16+
Dockerfile
17+
**/.env.test.local
18+
**/*.tsbuildinfo
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dist/
2+
lib/
3+
node_modules/
4+
jest.config.ts
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"root": true,
3+
"extends": [
4+
"airbnb-base",
5+
"airbnb-typescript/base",
6+
"prettier",
7+
"plugin:jest/recommended"
8+
],
9+
"parser": "@typescript-eslint/parser",
10+
"parserOptions": {
11+
"ecmaVersion": "latest",
12+
"sourceType": "module",
13+
"project": "./tsconfig.json"
14+
},
15+
"rules": {
16+
"no-underscore-dangle": "off",
17+
"class-methods-use-this": "off",
18+
"@typescript-eslint/naming-convention": [
19+
"error",
20+
{
21+
"selector": "typeParameter",
22+
"format": [
23+
"PascalCase"
24+
],
25+
"prefix": [
26+
"T"
27+
]
28+
},
29+
{
30+
"selector": "interface",
31+
"format": [
32+
"PascalCase"
33+
],
34+
"prefix": [
35+
"I"
36+
]
37+
},
38+
{
39+
"selector": "class",
40+
"modifiers": [
41+
"abstract"
42+
],
43+
"format": [
44+
"PascalCase"
45+
],
46+
"prefix": [
47+
"Abstract"
48+
]
49+
}
50+
]
51+
}
52+
}
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
**/node_modules/**
43+
jspm_packages/
44+
45+
# TypeScript v1 declaration files
46+
typings/
47+
48+
# TypeScript cache
49+
*.tsbuildinfo
50+
51+
# Optional npm cache directory
52+
.npm
53+
54+
# Yarn state files
55+
.pnp.*
56+
.yarn/*
57+
!.yarn/patches
58+
!.yarn/plugins
59+
!.yarn/releases
60+
!.yarn/sdks
61+
!.yarn/versions
62+
63+
# Optional eslint cache
64+
.eslintcache
65+
66+
# Microbundle cache
67+
.rpt2_cache/
68+
.rts2_cache_cjs/
69+
.rts2_cache_es/
70+
.rts2_cache_umd/
71+
72+
# Optional REPL history
73+
.node_repl_history
74+
75+
# Output of 'npm pack'
76+
*.tgz
77+
78+
# Yarn Integrity file
79+
.yarn-integrity
80+
81+
# dotenv environment variables file
82+
.env
83+
.env.test
84+
*.env
85+
.env*
86+
87+
# parcel-bundler cache (https://parceljs.org/)
88+
.cache
89+
90+
# Next.js build output
91+
.next
92+
93+
# Nuxt.js build / generate output
94+
.nuxt
95+
96+
# Gatsby files
97+
.cache/
98+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
99+
# https://nextjs.org/blog/next-9-1#public-directory-support
100+
# public
101+
102+
# vuepress build output
103+
.vuepress/dist
104+
105+
# Serverless directories
106+
.serverless/
107+
108+
# FuseBox cache
109+
.fusebox/
110+
111+
# DynamoDB Local files
112+
.dynamodb/
113+
114+
# TernJS port file
115+
.tern-port
116+
test-results/
117+
playwright-report/
118+
119+
# WebStorm
120+
.idea
121+
122+
### VisualStudioCode ###
123+
.vscode/* # Maybe .vscode/**/* instead - see comments
124+
!.vscode/settings.json
125+
!.vscode/tasks.json
126+
!.vscode/launch.json
127+
!.vscode/extensions.json
128+
129+
### VisualStudioCode Patch ###
130+
# Ignore all local history of files
131+
**/.history
132+
133+
# Storybook output
134+
storybook-static/
135+
136+
# MacOS system files
137+
.DS_Store
138+
139+
# Docusaurus build output
140+
website-docs/build
141+
website-docs/.docusaurus
142+
.vscode
143+
144+
lib
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/
2+
lib/
3+
node_modules/

0 commit comments

Comments
 (0)