Skip to content

Commit 023bbca

Browse files
committed
ADD: setup techdocs
1 parent 81b7b22 commit 023bbca

File tree

13 files changed

+4609
-9719
lines changed

13 files changed

+4609
-9719
lines changed

.github/workflows/cd-workflow.yaml

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,54 @@
1-
name: Deploy backstage
1+
name: Deploy Backstage
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
pull_request:
8-
branches:
9-
- main
4+
workflow_run:
5+
workflows: ["CI Workflow"]
6+
types:
7+
- completed
108

119
jobs:
1210
create-and-push-image:
1311
permissions:
1412
id-token: write
15-
contents: read
16-
name: "Create and push the Docker image to GAR"
13+
contents: read # Remove if not required
14+
15+
name: "Create and Push Docker Image to GAR"
1716
runs-on: ubuntu-latest
1817
defaults:
1918
run:
2019
shell: bash
2120

2221
steps:
23-
- name: Checkout
22+
- name: Checkout Repository
2423
uses: actions/checkout@v4
2524

26-
- id: 'setup-qemu'
27-
name: Set up QEMU
25+
- name: Set up QEMU
26+
id: setup-qemu
2827
uses: docker/setup-qemu-action@v3
2928

30-
- id: 'docker-buildx-setup'
31-
name: Set up Docker Buildx
29+
- name: Set up Docker Buildx
30+
id: docker-buildx-setup
3231
uses: docker/setup-buildx-action@v3
3332

34-
- name: 'Authenticate to Google Cloud'
35-
id: 'auth'
36-
uses: 'google-github-actions/auth@v2'
33+
- name: Authenticate to Google Cloud
34+
id: auth
35+
uses: google-github-actions/auth@v2
3736
with:
3837
create_credentials_file: true
3938
token_format: "access_token"
4039
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
4140
service_account: ${{ secrets.GCP_DEPLOY_SA }}
4241

43-
- name: "Login to GAR"
44-
id: 'login-gar'
42+
- name: Login to GAR
43+
id: login-gar
4544
uses: docker/login-action@v3
4645
with:
4746
registry: ${{ secrets.GCP_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_GAR_REPO }}
4847
username: oauth2accesstoken
4948
password: ${{ steps.auth.outputs.access_token }}
5049

51-
- id: 'build-and-push'
52-
name: 'Build and Push docker Image'
50+
- name: Build and Push Docker Image
51+
id: build-and-push
5352
uses: docker/build-push-action@v5
5453
with:
5554
push: true
@@ -60,44 +59,45 @@ jobs:
6059
build-args: |
6160
APP_ENV=docker
6261
63-
6462
deploy-image:
6563
permissions:
6664
id-token: write
67-
contents: read
65+
contents: read # Remove if not required
6866

69-
name: "Deploy image on cloud run"
67+
name: "Deploy Image on Cloud Run"
7068
runs-on: ubuntu-latest
69+
needs: create-and-push-image
7170
defaults:
7271
run:
7372
shell: bash
74-
needs: create-and-push-image
7573

7674
steps:
77-
- name: Checkout
75+
- name: Checkout Repository
7876
uses: actions/checkout@v4
7977

80-
- id: 'auth'
81-
name: 'Authenticate to Google Cloud'
82-
uses: 'google-github-actions/auth@v2'
78+
- name: Authenticate to Google Cloud
79+
id: auth
80+
uses: google-github-actions/auth@v2
8381
with:
8482
create_credentials_file: true
8583
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
8684
service_account: ${{ secrets.GCP_DEPLOY_SA }}
8785

8886
- name: Deploy to Cloud Run
89-
id: 'deploy'
90-
uses: 'google-github-actions/deploy-cloudrun@v2'
87+
id: deploy
88+
uses: google-github-actions/deploy-cloudrun@v2
9189
with:
9290
service: ${{ secrets.GCP_CLOUD_RUN_SERVICE }}
9391
image: ${{ secrets.GCP_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_GAR_REPO }}/backstage-image:${{ github.sha }}
9492
region: ${{ secrets.GCP_REGION }}
95-
flags: '--platform managed --allow-unauthenticated --port=7007'
96-
secrets: |-
93+
flags: |
94+
--platform managed
95+
--allow-unauthenticated
96+
--port=7007
97+
secrets: |
9798
GITHUB_TOKEN=github_token:latest
9899
GITLAB_TOKEN=gitlab_token:latest
99100
GOOGLE_CLIENT_ID=google_client_id:latest
100101
GOOGLE_CLIENT_SECRET=google_client_secret:latest
101102
PROD_GITHUB_CLIENT_SECRET=github_client_secret:latest
102103
PROD_GITHUB_CLIENT_ID=github_client_id:latest
103-

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@ pg_values.yaml
5757

5858
*secret.yaml
5959

60+
.vscode/
6061

6162
key/

app-config.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ techdocs:
3939
generator:
4040
runIn: 'docker' # Alternatives - 'local'
4141
publisher:
42-
type: 'local' # Alternatives - 'googleGcs' or 'awsS3'. Read documentation for using alternatives.
42+
type: 'googleGcs' # Alternatives - 'awsS3', 'azureBlobStorage'
4343

4444
# scaffolder:
4545

@@ -56,7 +56,11 @@ catalog:
5656
rules:
5757
- allow: [Template]
5858
- type: file
59-
target: ./examples/template/template.yaml
59+
target: ./examples/template/register-component.yaml
60+
rules:
61+
- allow: [Template]
62+
- type: file
63+
target: ./examples/template/sample-document.yaml
6064
rules:
6165
- allow: [Template]
6266

catalog-info.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ metadata:
77
It also enables users to store, view and discover information about projects in CODE.
88
annotations:
99
github.com/project-slug: 'codeuniversity/code-idp'
10-
# backstage.io/techdocs-ref: dir:.
10+
backstage.io/techdocs-ref: dir:.
1111
spec:
1212
type: website
1313
owner: code_idp_team
1414
lifecycle: production
1515

1616
---
17+
1718
apiVersion: backstage.io/v1alpha1
1819
kind: Component
1920
metadata:
@@ -35,4 +36,4 @@ spec:
3536
displayName: Infrastructure Team
3637
3738
children: []
38-
members: [Yvette]
39+
members: [Yvette...]
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# How to publish your documentation
2+
3+
You need the following things prepared to document a component:
4+
5+
* A [registered component](./how-to-register-a-component.md) (You can also do
6+
both setups, registration of the component and the documentation together in
7+
one go).
8+
9+
## Set the configuration file for MkDocs
10+
11+
* A file named `mkdocs.yml` in the root of the repository.
12+
13+
!!! example "mkdocs.yml file with techdocs configuration"
14+
15+
```yaml
16+
site_name: Publish Documentation Example
17+
docs_dir: docs
18+
plugins:
19+
- techdocs-core
20+
```
21+
22+
## Add annotation for documentation
23+
24+
You need to create the definition `annotations:` inside the `metadata:` section
25+
of your component and add the key `backstage.io/techdocs-ref` annotation in the
26+
`catalog-info.yaml` file.
27+
28+
!!! example "catalog-info.yaml file with techdocs information"
29+
30+
```yaml
31+
apiVersion: backstage.io/v1alpha1
32+
kind: Component
33+
metadata:
34+
#...
35+
annotations:
36+
backstage.io/techdocs-ref: dir:.
37+
#...
38+
```
39+
40+
## Add documentation
41+
42+
Create a directory called `docs`, define a file called `index.md` or `readme.md`,
43+
this will be the main page of your documentation.
44+
45+
Inside this you can `docs` directory you should be able to use Markdown files
46+
`*.md` to define your documentation.
47+
48+
### Formatting and capabilities
49+
50+
Documentation is formatted mainly using [MkDocs syntax](https://www.mkdocs.org/user-guide/writing-your-docs/),
51+
also with [Material for MkDocs features](https://squidfunk.github.io/mkdocs-material/reference/)
52+
and some specific features added to [Backstage](https://backstage.io/) as
53+
plugins.
54+
55+
56+
## References
57+
58+
* [TechDocs Documentation in Backstage](https://backstage.io/docs/features/techdocs/)

docs/how-to-register-a-component.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# How to register a component and define service dependency and RTO
1+
# How to register a component and define service dependency
22

33
## Register a new service(component)
44

docs/index.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,18 @@
1-
# Getting Started with CODE-IDP
1+
# Getting Started
22

3+
CODE-IDP is the platform to automate deployment of node and flask applications, centralize software components(Microservices, Websites, Libraries, APIs, Data pipelines, ML models ) and publish technical documentation.
4+
5+
Current components defined can be found in the [Catalog home]()
6+
7+
Documentation defined per service can be found in the [Documentation section]()
8+
9+
## Deploy your application
10+
11+
- [Quick tutorial to deploy your application](./how-to-deploy-your-app.md)
12+
13+
14+
## Register and Document Your Software Projects
15+
16+
- [Register your components](./how-to-register-a-component.md)
17+
18+
- [Publish documentaion](./how-to-publish-documentation.md)
File renamed without changes.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: backstage.io/v1alpha1
2+
kind: Component
3+
metadata:
4+
name: sample-document
5+
annotations:
6+
backstage.io/techdocs-ref: dir:.
7+
spec:
8+
type: documentation
9+
lifecycle: experimental
10+
owner: guests
11+
system: examples

mkdocs.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
site_name: CODE-IDP Platform
2+
site_description: This is the user guide for the CODE-IDP platform.
3+
docs_dir: docs
4+
nav:
5+
- Overview:
6+
- Introduction: 'index.md'
7+
- Components:
8+
- Register Your Software Component: 'how-to-register-a-component.md'
9+
- Technical Documentation:
10+
- Publish Your Docs: 'how-to-publish-documentation.md'
11+
12+
plugins:
13+
- techdocs-core
14+
- include-markdown

0 commit comments

Comments
 (0)