Merge pull request #99 from spotify/rugvip/list-services
list services + quicker docker builds
This commit is contained in:
+11
-9
@@ -1,3 +1,13 @@
|
||||
ARG base_image=debian:buster
|
||||
|
||||
### Scaffolder Stage
|
||||
### needs extra cookiecutter
|
||||
FROM debian:buster AS scaffolder
|
||||
RUN apt-get update && apt-get install -y python-pip
|
||||
RUN apt-get install -y python-backports.functools-lru-cache
|
||||
RUN pip install cookiecutter==1.7.0 --index-url https://pypi.python.org/simple
|
||||
|
||||
|
||||
### Builder Stage
|
||||
FROM golang:1.13 AS build
|
||||
ARG service
|
||||
@@ -16,7 +26,7 @@ RUN go build .
|
||||
|
||||
|
||||
### Running Container Stage
|
||||
FROM debian:buster AS default
|
||||
FROM ${base_image}
|
||||
ARG service
|
||||
|
||||
RUN apt-get update && apt-get install -y ca-certificates
|
||||
@@ -26,11 +36,3 @@ WORKDIR /app/
|
||||
COPY --from=build /build/$service/$service /app/service
|
||||
|
||||
CMD ["./service"]
|
||||
|
||||
|
||||
### Scaffolder Stage
|
||||
### needs extra cookiecutter
|
||||
FROM default AS scaffolder
|
||||
RUN apt-get update && apt-get install -y python-pip
|
||||
RUN apt-get install -y python-backports.functools-lru-cache
|
||||
RUN pip install cookiecutter==1.7.0 --index-url https://pypi.python.org/simple
|
||||
|
||||
+1
-4
@@ -15,7 +15,6 @@ services:
|
||||
container_name: boss-identity
|
||||
build:
|
||||
context: backend
|
||||
target: default
|
||||
args:
|
||||
service: identity
|
||||
restart: unless-stopped
|
||||
@@ -34,7 +33,6 @@ services:
|
||||
container_name: boss-builds
|
||||
build:
|
||||
context: backend
|
||||
target: default
|
||||
args:
|
||||
service: builds
|
||||
restart: unless-stopped
|
||||
@@ -45,12 +43,11 @@ services:
|
||||
- inventory
|
||||
links:
|
||||
- inventory
|
||||
container_name: boss-scaffolder
|
||||
build:
|
||||
context: backend
|
||||
target: scaffolder
|
||||
args:
|
||||
service: scaffolder
|
||||
base_image: scaffolder
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./backend/scaffolder/templates:/app/templates:ro
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
import React, { FC } from 'react';
|
||||
import { Typography, makeStyles, Theme, Grid } from '@material-ui/core';
|
||||
import {
|
||||
Typography,
|
||||
makeStyles,
|
||||
Theme,
|
||||
Grid,
|
||||
LinearProgress,
|
||||
} from '@material-ui/core';
|
||||
import HomePageTimer from '../HomepageTimer';
|
||||
import {
|
||||
EntityLink,
|
||||
@@ -10,6 +16,37 @@ import {
|
||||
theme,
|
||||
} from '@backstage/core';
|
||||
import SquadTechHealth from './SquadTechHealth';
|
||||
import { useAsync } from 'react-use';
|
||||
|
||||
import { inventoryV1 } from '@backstage/protobuf-definitions';
|
||||
|
||||
const client = new inventoryV1.Client('http://localhost:8080');
|
||||
|
||||
const entityUriRegex = /boss:\/\/service\/(.*)/;
|
||||
|
||||
async function fetchServices() {
|
||||
const req = new inventoryV1.ListEntitiesRequest();
|
||||
req.setUriprefix('boss://service/');
|
||||
const res = await client.listEntities(req);
|
||||
|
||||
return res
|
||||
.getEntitiesList()
|
||||
.map(entity => {
|
||||
const match = entity.getUri()?.match(entityUriRegex);
|
||||
console.log('DEBUG: match =', match);
|
||||
if (!match) {
|
||||
return undefined;
|
||||
}
|
||||
return { id: match[1], kind: 'service' };
|
||||
})
|
||||
.filter(Boolean)
|
||||
.map(x => x!);
|
||||
}
|
||||
|
||||
const STATIC_DATA = [
|
||||
{ id: 'backstage', kind: 'service' },
|
||||
{ id: 'backstage-microsite', kind: 'website' },
|
||||
];
|
||||
|
||||
const useStyles = makeStyles<Theme>(theme => ({
|
||||
mainContentArea: {
|
||||
@@ -26,15 +63,17 @@ const useStyles = makeStyles<Theme>(theme => ({
|
||||
|
||||
const HomePage: FC<{}> = () => {
|
||||
const classes = useStyles();
|
||||
const status = useAsync(fetchServices);
|
||||
const columns = [
|
||||
{ id: 'entity', label: 'ID' },
|
||||
{ id: 'kind', label: 'Kind' },
|
||||
];
|
||||
|
||||
const data = [
|
||||
{ id: 'backstage', kind: 'service' },
|
||||
{ id: 'backstage-microsite', kind: 'website' },
|
||||
].map(({ id, kind }) => {
|
||||
if (status.loading) {
|
||||
return <LinearProgress />;
|
||||
}
|
||||
|
||||
const data = STATIC_DATA.concat(status?.value ?? []).map(({ id, kind }) => {
|
||||
return {
|
||||
id,
|
||||
entity: (
|
||||
|
||||
Reference in New Issue
Block a user