Skip to content

Commit 4129abb

Browse files
authored
Merge pull request #1 from stack-spot/feat/new-actions-prd
Feat/new actions prd
2 parents 9656c44 + 5735136 commit 4129abb

File tree

40 files changed

+1993
-0
lines changed

40 files changed

+1993
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Este arquivo pode ser usado para ignorar arquivos e pastas ao publicar um artefato.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
schema-version: v3
2+
kind: action
3+
metadata:
4+
name: runtime-cancel-run-action
5+
display-name: runtime-cancel-run-action
6+
description: runtime-cancel-run-action
7+
version: 0.0.1
8+
spec:
9+
type: python
10+
docs:
11+
pt-br: docs/pt-br/docs.md
12+
en-us: docs/en-us/docs.md
13+
repository: https://github.com/stack-spot/workflow-stackspot-actions-runtime-selfhosted.git
14+
inputs:
15+
- label: Run id
16+
name: run_id
17+
type: text
18+
required: false
19+
help: 'Inform execution Id'
20+
python:
21+
workdir: .
22+
script: script.py
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<!--
2+
******************************************
3+
4+
- THIS IS AN EXAMPLE OF HOW TO FILL OUT YOUR DOCUMENTATION OF CONTENT.
5+
6+
- FILL OUT THE TEMPLATE BELOW WITH YOUR INFORMATION SO OTHER PEOPLE CAN USE IT. THIS DOCUMENTATION WILL APPEAR ON THE SECTION OF THE STACKSPOT PORTAL.
7+
8+
******************************************
9+
-->
10+
## Action name
11+
12+
<!-- Write concisely describing your Action. -->
13+
14+
## Requirements
15+
16+
<!--
17+
[This is a guideline; delete this content and write your information outside this markup. <!-- ]
18+
19+
- Describe the requirements that the user needs to know before using the Action.
20+
-->
21+
22+
## Usage
23+
24+
<!--
25+
[This is a guideline; delete this content and write your information outside this markup. <!-- ]
26+
27+
Add the steps for the user to use your Action:
28+
29+
- What are the inputs?
30+
- Which methods should we know?
31+
- What are the resources?
32+
- Add the Action dependencies, if necessary.
33+
34+
Example:
35+
On your application’s folder, run the **action-doc-template** action and follow the instructions:
36+
1. Execute the command:
37+
`
38+
stk run action /Users/Home/action-doc-template
39+
`
40+
-->
41+
42+
## Release Notes
43+
44+
<!--
45+
[This is a guideline; delete this content and write your information outside this markup. <!-- ]
46+
47+
This section is only necessary if you publish a new Action version. Add what was changed, fixed, and the new features.
48+
49+
Example:
50+
### action-doc-template v1.0.0
51+
52+
#### Features
53+
Added new templates
54+
-->
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<!--
2+
******************************************
3+
4+
- ESTE É APENAS UM EXEMPLO DE COMO PREENCHER A DOCUMENTAÇÃO DO SEU CONTEUDO.
5+
6+
- PREENCHA O TEMPLATE COM AS INFORMAÇÕES DO SEU CONTEUDO PARA QUE OUTROS USUÁRIO CONSIGAM UTILIZÁ-LO. ESSA DOCUMENTAÇÃO SERÁ EXPOSTA NA PÁGINA DO CONTEUDO NO PORTAL DA STACKSPOT.
7+
8+
******************************************
9+
-->
10+
## Nome Action
11+
12+
<!-- Escreva uma descrição clara e breve sobre a sua Action. -->
13+
14+
## Pré-requisitos
15+
16+
<!--
17+
[Isto é uma orientação, apague essa o conteúdo e escreva suas informações fora desta marcação <!-- ]
18+
19+
- Descreva quais os requisitos que o usuário precisa saber antes de usar a Action.
20+
-->
21+
22+
## Uso
23+
24+
<!--
25+
[Isto é uma orientação, apague essa o conteúdo e escreva suas informações fora desta marcação <!-- ]
26+
27+
Descreva as etapas para o usuário utilizar esta Action:
28+
29+
- Quais as entradas
30+
- Quais os métodos usar
31+
- Quais os recursos
32+
- E se necessário, adicione as dependências de sua Action.
33+
34+
Exemplo:
35+
Na pasta do seu aplicativo, execute a **action-doc-template** para preencher os arquivos abaixo:
36+
1. Execute o comando:
37+
`
38+
stk run action /Users/Home/action-doc-template
39+
`
40+
-->
41+
42+
## Release Notes
43+
44+
<!--
45+
[Isto é uma orientação, apague essa o conteúdo e escreva suas informações fora desta marcação <!-- ]
46+
47+
Esta seção só é necessária se você publicar uma nova versão da Action. Apenas adicione o que foi modificado ou adicionado.
48+
49+
Exemplo:
50+
### action-doc-template v1.0.0
51+
52+
#### Features
53+
Novos templates foram adicionados.
54+
-->
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from oscli.core.http import post_with_authorization
2+
3+
def run(metadata):
4+
5+
RUN_ID = metadata.inputs.get('run_id')
6+
7+
if RUN_ID == "":
8+
print("- RUN_ID was not provided.")
9+
print(" No need to cancel it.")
10+
exit(0)
11+
12+
# Calling Cancel Action
13+
print("Cancelling Run...")
14+
15+
print(f"Requesting Run {RUN_ID} to be cancelled")
16+
17+
cancel_request = post_with_authorization(url=f"https://runtime-manager.v1.stackspot.com/v1/run/cancel/{RUN_ID}?force=true",
18+
headers={'Content-Type': 'application/json' },
19+
body=None,
20+
timeout=20)
21+
22+
if cancel_request.status_code == 202:
23+
print(f"- RUN {RUN_ID} cancelled successfully!")
24+
25+
elif cancel_request.status_code == 404:
26+
print(f"- RUN {RUN_ID} not found.")
27+
28+
elif cancel_request.status_code == 422:
29+
print(f"- RUN {RUN_ID} not currently running. Unable to Abort.")
30+
31+
else:
32+
print("- Error cancelling run")
33+
print("- Status:", cancel_request.status_code)
34+
print("- Error:", cancel_request.reason)
35+
print("- Response:", cancel_request.text)
36+
exit(1)
37+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# This file can be utilized to exclude files and folders during the publication of an artifact.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
schema-version: v3
2+
kind: action
3+
metadata:
4+
name: runtime-create-manifest-action
5+
display-name: runtime-create-manifest-action
6+
description: runtime-create-manifest-action
7+
version: 0.0.1
8+
spec:
9+
type: shell
10+
docs:
11+
pt-br: docs/pt-br/docs.md
12+
en-us: docs/en-us/docs.md
13+
repository: https://github.com/stack-spot/workflow-stackspot-actions-runtime-selfhosted.git
14+
inputs:
15+
- label: Environment used to deploy
16+
name: environment
17+
type: text
18+
required: true
19+
help: 'Inform environment used to deploy'
20+
21+
- label: Workspace used to deploy
22+
name: workspace
23+
type: text
24+
required: true
25+
help: 'Inform workspace used to deploy'
26+
27+
- label: Deploy version tag
28+
name: version_tag
29+
type: text
30+
required: true
31+
help: 'Inform deploy version tag'
32+
33+
- label: Branch to perform checkout in Runtime
34+
name: branch
35+
type: text
36+
required: false
37+
help: 'Inform branch to perform checkout in Runtime'
38+
39+
- label: Path to API file to publish on StackSpot Catalog API
40+
name: open_api_path
41+
type: text
42+
required: false
43+
help: 'Inform path to API file to publish on StackSpot Catalog API'
44+
45+
- label: Dynamic Inputs
46+
name: dynamic_inputs
47+
type: text
48+
required: false
49+
help: '--key1 value1 --key2 value2'
50+
51+
- label: Verbose configuration
52+
name: verbose
53+
type: bool
54+
required: false
55+
default: true
56+
help: 'verbose configuration'
57+
58+
- label: stk
59+
name: stk
60+
type: text
61+
required: false
62+
default: stk
63+
help: 'stk'
64+
65+
66+
shell:
67+
workdir: .
68+
69+
script:
70+
linux: |
71+
chmod +x {{component_path}}/script.sh
72+
sh {{component_path}}/script.sh
73+
mac: |
74+
chmod +x {{component_path}}/script.sh
75+
sh {{component_path}}/script.sh
76+
windows: |
77+
echo "Not supported"
78+
79+
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<!--
2+
******************************************
3+
4+
- THIS IS AN EXAMPLE OF HOW TO FILL OUT YOUR DOCUMENTATION OF CONTENT.
5+
6+
- FILL OUT THE TEMPLATE BELOW WITH YOUR INFORMATION SO OTHER PEOPLE CAN USE IT. THIS DOCUMENTATION WILL APPEAR ON THE SECTION OF THE STACKSPOT PORTAL.
7+
8+
******************************************
9+
-->
10+
## Action name
11+
12+
<!-- Write concisely describing your Action. -->
13+
14+
## Requirements
15+
16+
<!--
17+
[This is a guideline; delete this content and write your information outside this markup. <!-- ]
18+
19+
- Describe the requirements that the user needs to know before using the Action.
20+
-->
21+
22+
## Usage
23+
24+
<!--
25+
[This is a guideline; delete this content and write your information outside this markup. <!-- ]
26+
27+
Add the steps for the user to use your Action:
28+
29+
- What are the inputs?
30+
- Which methods should we know?
31+
- What are the resources?
32+
- Add the Action dependencies, if necessary.
33+
34+
Example:
35+
On your application’s folder, run the **action-doc-template** action and follow the instructions:
36+
1. Execute the command:
37+
`
38+
stk run action /Users/Home/action-doc-template
39+
`
40+
-->
41+
42+
## Release Notes
43+
44+
<!--
45+
[This is a guideline; delete this content and write your information outside this markup. <!-- ]
46+
47+
This section is only necessary if you publish a new Action version. Add what was changed, fixed, and the new features.
48+
49+
Example:
50+
### action-doc-template v1.0.0
51+
52+
#### Features
53+
Added new templates
54+
-->
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<!--
2+
******************************************
3+
4+
- ESTE É APENAS UM EXEMPLO DE COMO PREENCHER A DOCUMENTAÇÃO DO SEU CONTEUDO.
5+
6+
- PREENCHA O TEMPLATE COM AS INFORMAÇÕES DO SEU CONTEUDO PARA QUE OUTROS USUÁRIO CONSIGAM UTILIZÁ-LO. ESSA DOCUMENTAÇÃO SERÁ EXPOSTA NA PÁGINA DO CONTEUDO NO PORTAL DA STACKSPOT.
7+
8+
******************************************
9+
-->
10+
## Nome Action
11+
12+
<!-- Escreva uma descrição clara e breve sobre a sua Action. -->
13+
14+
## Pré-requisitos
15+
16+
<!--
17+
[Isto é uma orientação, apague essa o conteúdo e escreva suas informações fora desta marcação <!-- ]
18+
19+
- Descreva quais os requisitos que o usuário precisa saber antes de usar a Action.
20+
-->
21+
22+
## Uso
23+
24+
<!--
25+
[Isto é uma orientação, apague essa o conteúdo e escreva suas informações fora desta marcação <!-- ]
26+
27+
Descreva as etapas para o usuário utilizar esta Action:
28+
29+
- Quais as entradas
30+
- Quais os métodos usar
31+
- Quais os recursos
32+
- E se necessário, adicione as dependências de sua Action.
33+
34+
Exemplo:
35+
Na pasta do seu aplicativo, execute a **action-doc-template** para preencher os arquivos abaixo:
36+
1. Execute o comando:
37+
`
38+
stk run action /Users/Home/action-doc-template
39+
`
40+
-->
41+
42+
## Release Notes
43+
44+
<!--
45+
[Isto é uma orientação, apague essa o conteúdo e escreva suas informações fora desta marcação <!-- ]
46+
47+
Esta seção só é necessária se você publicar uma nova versão da Action. Apenas adicione o que foi modificado ou adicionado.
48+
49+
Exemplo:
50+
### action-doc-template v1.0.0
51+
52+
#### Features
53+
Novos templates foram adicionados.
54+
-->
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
$HOME/.{{ inputs.stk }}/bin/{{ inputs.stk }} use workspace {{ inputs.workspace }}
2+
3+
FLAGS=$(echo "--env {{ inputs.environment }} --version {{ inputs.version_tag }}")
4+
5+
if [ ! -z "{{ inputs.branch }}" ]; then
6+
FLAGS=$(echo "$FLAGS --branch {{ inputs.branch }}")
7+
fi
8+
9+
if [ ! -z "{{ inputs.open_api_path }}" ]; then
10+
FLAGS=$(echo "$FLAGS --open-api-path {{ inputs.open_api_path }}")
11+
fi
12+
13+
if [ ! -z "{{ inputs.dynamic_inputs }}" ]; then
14+
FLAGS=$(echo "$FLAGS {{ inputs.dynamic_inputs }}")
15+
fi
16+
17+
if [ ! -z "{{ inputs.verbose }}" ]; then
18+
echo "$HOME/.{{ inputs.stk }}/bin/{{ inputs.stk }} deploy plan FLAGS = $FLAGS"
19+
fi
20+
21+
$HOME/.{{ inputs.stk }}/bin/{{ inputs.stk }} deploy plan $FLAGS

0 commit comments

Comments
 (0)