Scaffolder Documentation (#1616)
* docs(scaffolder): Added some reference for the Template kind in the service catalog * docs(scaffolder): adding a basic readme for the scaffolder * docs(scaffolder): more small fixes * chore(scaffolder): removing unused routes in the scaffolder * docs(scaffolder): fixing linking to the template entity * docs(scaffolder): fixing indentation * docs(scaffolder): rewrite a little * chore(scaffolder): Added some more documentation sections * docs(scaffolder): added some documentation about loading your own templates * docs(scaffolder): created some great documentation. make docs great again * docs(scaffolder): added some more info about creating your own templater * chore(scaffolder): finshing of create your own templater docs * docs(scaffolder): updating the last of the preparr * docs(scaffolder): think docs are great for scaffolder again * chore(scaffolder): fixing issue with publisher base mistyping * docs(scaffolder): creating some how to use documentation * docs(scaffolder): more user docs for the scaffolder * docs(scaffolder): fix header * docs(scaffolder): fixing * docs(scaffolder): shuffle around the documenation
This commit is contained in:
@@ -8,6 +8,7 @@ metadata:
|
||||
- Recommended
|
||||
- React
|
||||
spec:
|
||||
owner: web@example.com
|
||||
templater: cookiecutter
|
||||
type: website
|
||||
path: '.'
|
||||
|
||||
@@ -8,6 +8,7 @@ metadata:
|
||||
- Recommended
|
||||
- Java
|
||||
spec:
|
||||
owner: service@example.com
|
||||
templater: cookiecutter
|
||||
type: service
|
||||
path: '.'
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Publisher } from './types';
|
||||
import { PublisherBase } from './types';
|
||||
import { Octokit } from '@octokit/rest';
|
||||
|
||||
import { JsonValue } from '@backstage/config';
|
||||
import { RequiredTemplateValues } from '../templater';
|
||||
import { Repository, Remote, Signature, Cred } from 'nodegit';
|
||||
|
||||
export class GithubPublisher implements Publisher {
|
||||
export class GithubPublisher implements PublisherBase {
|
||||
private client: Octokit;
|
||||
constructor({ client }: { client: Octokit }) {
|
||||
this.client = client;
|
||||
|
||||
@@ -21,7 +21,7 @@ import { JsonValue } from '@backstage/config';
|
||||
* Publisher is in charge of taking a folder created by
|
||||
* the templater, and pushing it to a remote storage
|
||||
*/
|
||||
export type Publisher = {
|
||||
export type PublisherBase = {
|
||||
/**
|
||||
*
|
||||
* @param opts object containing the template entity from the service
|
||||
|
||||
@@ -26,13 +26,13 @@ import {
|
||||
RequiredTemplateValues,
|
||||
StageContext,
|
||||
TemplaterBuilder,
|
||||
Publisher,
|
||||
PublisherBase,
|
||||
} from '../scaffolder';
|
||||
|
||||
export interface RouterOptions {
|
||||
preparers: PreparerBuilder;
|
||||
templaters: TemplaterBuilder;
|
||||
publisher: Publisher;
|
||||
publisher: PublisherBase;
|
||||
|
||||
logger: Logger;
|
||||
dockerClient: Docker;
|
||||
@@ -55,18 +55,6 @@ export async function createRouter(
|
||||
const jobProcessor = new JobProcessor();
|
||||
|
||||
router
|
||||
.get('/v1/job/:jobId/stage/:index/log', ({ params }, res) => {
|
||||
const job = jobProcessor.get(params.jobId);
|
||||
|
||||
if (!job) {
|
||||
res.status(404).send({ error: 'job not found' });
|
||||
return;
|
||||
}
|
||||
|
||||
const { log } = job.stages[Number(params.index)] ?? { log: [] };
|
||||
|
||||
res.send(log.join(''));
|
||||
})
|
||||
.get('/v1/job/:jobId', ({ params }, res) => {
|
||||
const job = jobProcessor.get(params.jobId);
|
||||
|
||||
@@ -126,7 +114,7 @@ export async function createRouter(
|
||||
{
|
||||
name: 'Publish template',
|
||||
handler: async (ctx: StageContext<{ resultDir: string }>) => {
|
||||
ctx.logger.info('Should not store the template');
|
||||
ctx.logger.info('Will now store the template');
|
||||
const { remoteUrl } = await publisher.publish({
|
||||
entity: ctx.entity,
|
||||
values: ctx.values,
|
||||
|
||||
Reference in New Issue
Block a user