Skip to content

Commit

Permalink
Merge pull request backstage#264 from RoadieHQ/ch4659
Browse files Browse the repository at this point in the history
Remove http:request action
  • Loading branch information
Nicolas Arnold committed Oct 27, 2021
2 parents def2155 + e748b16 commit e403ce3
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 12,622 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ describe('scaffolder http request', () => {
})

describe('Navigating to the actions page', () => {
it('should show http:request', () => {
cy.contains('http:request');
});

it('should show http:backstage:request', () => {
cy.contains('http:backstage:request');
});
Expand Down
3 changes: 1 addition & 2 deletions packages/backend/src/plugins/scaffolder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
createBuiltinActions,
TemplateAction
} from '@backstage/plugin-scaffolder-backend';
import { createHttpAction, createHttpBackstageAction } from '@roadiehq/scaffolder-backend-module-http-request';
import { createHttpBackstageAction } from '@roadiehq/scaffolder-backend-module-http-request';
import Docker from 'dockerode';
import { Router } from 'express';
import type { PluginEnvironment } from '../types';
Expand All @@ -49,7 +49,6 @@ export const createActions = (options: {
});

return [
createHttpAction(),
createHttpBackstageAction({config}),
...defaultActions
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Welcome to the `http` actions for the `scaffolder-backend`.

This contains one action; `http:backstage:request`.

The `http:backstage:request` action allows the task to call any of the backstage APIs available to the user that triggers it. The action takes care of passing the authentication token of the user to the task execution so that the action can perform actions on behalf of the user that triggers it.

## Getting started

You need to configure the action in your backend:
Expand All @@ -20,7 +24,6 @@ Configure the action:
// packages/backend/src/plugins/scaffolder.ts

const actions = [
createHttpAction(),
createHttpBackstageAction({ config }),
...createBuiltInActions({
containerRunner,
Expand Down Expand Up @@ -59,33 +62,20 @@ spec:
parameters:
- title: Fill in some params
properties:
httpGetUrl:
title: Get Url
httpGetPath:
title: Get Path
type: string
description: The url endpoint you want to get
description: The path you want to get on your backstage instance
ui:autofocus: true
ui:options:
rows: 5

steps:
- id: get_request
name: Get request
action: http:request
input:
method: 'GET'
url: '{{ parameters.httpGetUrl }}'
headers:
test: 'hello'
foo: 'bar'
params:
name: 'test'
bar: 'foo'

- id: backstage_request
name: backstage request
action: http:backstage:request
input:
method: 'POST'
method: 'GET'
path: '/api/proxy/snyk/org/org/project/project-id/aggregated-issues'
headers:
test: 'hello'
Expand All @@ -95,12 +85,9 @@ spec:
bar: 'foo'

output:
getResponse: '{{ steps.get_request.output.body }}'
getCode: '{{ steps.get_request.output.code }}'
getHeaders: '{{ steps.get_request.output.headers }}'
proxyResponse: '{{ steps.backstage_request_with_input.output.body }}'
proxyCode: '{{ steps.backstage_request_with_input.output.code }}'
proxyHeaders: '{{ steps.backstage_request_with_input.output.headers }}'
getResponse: '{{ steps.backstage_request.output.body }}'
getCode: '{{ steps.backstage_request.output.code }}'
getHeaders: '{{ steps.backstage_request.output.headers }}'
```

You can also visit the `/create/actions` route in your Backstage application to find out more about the parameters this action accepts when it's installed to configure how you like.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
import { Config } from '@backstage/config';
import { TemplateAction } from '@backstage/plugin-scaffolder-backend';

// @public (undocumented)
export function createHttpAction(): TemplateAction<any>;

// @public (undocumented)
export function createHttpBackstageAction(options: {
config: Config;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@roadiehq/scaffolder-backend-module-http-request",
"version": "1.0.1",
"version": "2.0.0",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { createHttpAction } from './request';
export { createHttpBackstageAction } from './backstageRequest';

This file was deleted.

This file was deleted.

0 comments on commit e403ce3

Please sign in to comment.