Merge pull request #13577 from matteosilv/master
fixing techdocs-cli Docker client creation
This commit is contained in:
@@ -89,6 +89,23 @@ describe('end-to-end', () => {
|
||||
expect(proc.exit).toEqual(0);
|
||||
});
|
||||
|
||||
it('can generate with DOCKER_* TLS variables and --no-docker option', async () => {
|
||||
const env = {
|
||||
DOCKER_HOST: 'tcp://localhost:2376',
|
||||
DOCKER_TLS_CERTDIR: '/certs',
|
||||
DOCKER_TLS_VERIFY: '1',
|
||||
DOCKER_CERT_PATH: '/certs/client',
|
||||
...process.env,
|
||||
};
|
||||
const proc = await executeCommand(entryPoint, ['generate', '--no-docker'], {
|
||||
cwd,
|
||||
timeout,
|
||||
env,
|
||||
});
|
||||
expect(proc.stdout).toContain('Successfully generated docs');
|
||||
expect(proc.exit).toEqual(0);
|
||||
});
|
||||
|
||||
it('can serve in mkdocs', async () => {
|
||||
const proc = await executeCommand(
|
||||
entryPoint,
|
||||
|
||||
@@ -22,7 +22,10 @@ import {
|
||||
TechdocsGenerator,
|
||||
ParsedLocationAnnotation,
|
||||
} from '@backstage/plugin-techdocs-node';
|
||||
import { DockerContainerRunner } from '@backstage/backend-common';
|
||||
import {
|
||||
ContainerRunner,
|
||||
DockerContainerRunner,
|
||||
} from '@backstage/backend-common';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import {
|
||||
convertTechDocsRefToLocationAnnotation,
|
||||
@@ -66,8 +69,12 @@ export default async function generate(opts: OptionValues) {
|
||||
});
|
||||
|
||||
// Docker client (conditionally) used by the generators, based on techdocs.generators config.
|
||||
const dockerClient = new Docker();
|
||||
const containerRunner = new DockerContainerRunner({ dockerClient });
|
||||
let containerRunner: ContainerRunner | undefined;
|
||||
|
||||
if (opts.docker) {
|
||||
const dockerClient = new Docker();
|
||||
containerRunner = new DockerContainerRunner({ dockerClient });
|
||||
}
|
||||
|
||||
let parsedLocationAnnotation = {} as ParsedLocationAnnotation;
|
||||
if (opts.techdocsRef) {
|
||||
|
||||
Reference in New Issue
Block a user