Skip to content

Commit

Permalink
Minor code improvements, lint fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Büchse <[email protected]>
  • Loading branch information
mbuechse committed Nov 21, 2023
1 parent 29979ee commit 19d66f9
Show file tree
Hide file tree
Showing 18 changed files with 82 additions and 82 deletions.
40 changes: 20 additions & 20 deletions populateStds.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
const fs = require('fs')
const sidebars = require('./sidebarsStandards.js')

sidebars = require('./sidebarsStandards.js')
sidebars.standards.splice(3)
sidebarItems = []
sidebars.standards[2].items = sidebarItems

fns = fs.readdirSync('standards/').filter((fn) => fn.startsWith('scs-') && fn.endsWith('.md') && !fn.startsWith('scs-X'))
var filenames = fs
.readdirSync('standards/')
.filter((fn) => fn.startsWith('scs-') && fn.endsWith('.md') && !fn.startsWith('scs-X'))

keys = ['title', 'type', 'status', 'track', 'stabilized_at', 'obsoleted_at', 'replaces', 'authors', 'state']

Expand All @@ -14,7 +12,7 @@ today = new Date().toISOString().slice(0, 10)

// collect all the information sorted into a track/adr-id/version hierarchy
tracks = {}
fns.forEach((fn) => {
filenames.forEach((fn) => {
var components = fn.split('-')
var adrId = components[1]
var version = components[2]
Expand All @@ -34,14 +32,11 @@ fns.forEach((fn) => {
if (track === undefined) return
if (tracks[track] === undefined) tracks[track] = {}
var standards = tracks[track]
if (standards[adrId] === undefined) standards[adrId] = {active: [], versions: []}
if (standards[adrId] === undefined) standards[adrId] = {versions: []}
standards[adrId].versions.push(obj)
obj.isStable = obj.stabilized_at && obj.stabilized_at <= today
obj.isObsolete = obj.obsoleted_at && obj.obsoleted_at <= today
obj.isActive = obj.isStable && !obj.isObsolete
if (obj.isStable) {
standards[adrId].active.push(version)
}
})

function readPrefixLines(fn) {
Expand All @@ -58,6 +53,7 @@ function readPrefixLines(fn) {

// walk down the hierarchy, building adr overview pages, track overview pages, and total overview page
// as well as the new sidebar
sidebarItems = []
var lines = readPrefixLines('standards/standards/overview.md')
lines.push('| Standard | Track | Description | Active Versions |')
lines.push('| --------- | ------ | ------------ | ---------------- |')
Expand All @@ -74,13 +70,14 @@ Object.entries(tracks).forEach((trackEntry) => {
}
sidebarItems.push(trackItem)
var tlines = readPrefixLines(`standards/${track.toLowerCase()}/index.md`)
if (!tlines.length) tlines.push(`${track} Standards\n`)
tlines.push('| Standard | Description | Active Versions |')
tlines.push('| --------- | ------------ | ---------------- |')
Object.entries(trackEntry[1]).forEach((standardEntry) => {
var active = standardEntry[1].active
var versions = standardEntry[1].versions
var activeLinks = versions.filter((v) => v.isActive).map((v) => `[${v.version}](/standards/${v.id})`)
var description = versions[versions.length - 1].title
var icon = active.length ? '🟢' : '🟠'
var icon = activeLinks.length ? '🟢' : '🟠'
var adrId = standardEntry[0]
var standardItem = {
type: 'category',
Expand All @@ -89,17 +86,16 @@ Object.entries(tracks).forEach((trackEntry) => {
type: 'doc',
id: `${track.toLowerCase()}/scs-${adrId}`,
},
items: [
]
items: [],
}
trackItem.items.push(standardItem)
var slines = readPrefixLines(`standards/${track.toLowerCase()}/scs-${adrId}.md`)
if (!slines.length) slines.push(`scs-${adrId}: ${description}\n`)
slines.push('| Version | Type | State | stabilized | obsoleted |')
slines.push('| -------- | ----- | ------- | ---------- | --------- |')
var link = `[${icon} scs-${adrId}](/standards/${track.toLowerCase()}/scs-${adrId})`
var activeLinks = versions.filter((v) => v.isActive).map((v) => `[${v.version}](/standards/${v.id})`)
lines.push(`| ${link} | ${track} | ${description} | ${activeLinks.join(', ')} |`)
tlines.push(`| ${link} | ${description} | ${activeLinks.join(', ')} |`)
lines.push(`| ${link} | ${track} | ${description} | ${activeLinks.join(', ')} |`)
tlines.push(`| ${link} | ${description} | ${activeLinks.join(', ')} |`)
standardEntry[1].versions.forEach((obj) => {
var icon = obj.isActive ? '🟢' : '🟠'
var versionItem = {
Expand All @@ -108,20 +104,24 @@ Object.entries(tracks).forEach((trackEntry) => {
id: obj.id,
}
standardItem.items.push(versionItem)
slines.push(`| [${icon} scs-${adrId}-${obj.version}](/standards/${obj.id}) | ${obj.type} | ${obj.status || obj.state} | ${obj.stabilized_at || '-'} | ${obj.obsoleted_at || '-'} |`)
slines.push(`| [${icon} scs-${adrId}-${obj.version}](/standards/${obj.id}) | ${obj.type} | ${obj.status || obj.state} | ${obj.stabilized_at || '-'} | ${obj.obsoleted_at || '-'} |`)
})
slines.push('') // file should end with a single newline character
fs.writeFileSync(`standards/${track.toLowerCase()}/scs-${adrId}.md`, slines.join('\n'), 'utf8')
})
tlines.push('') // file should end with a single newline character
fs.writeFileSync(`standards/${track.toLowerCase()}/index.md`, tlines.join('\n'), 'utf8')
})
lines.push('') // file should end with a single newline character
fs.writeFileSync(`standards/standards/overview.md`, lines.join('\n'), 'utf8')

sidebars.standards.splice(3) // remove unnecessary remainder
sidebars.standards[2].items = sidebarItems // reset standards items
var newSidebars = `// @ts-check
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = ${JSON.stringify(sidebars, null, ' ')}
module.exports = sidebars
`

fs.writeFileSync('./sidebarsStandards.js', newSidebars, 'utf8')
6 changes: 3 additions & 3 deletions standards/global/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ This track encompasses the foundational standards that guide the overall structu

| Standard | Description | Active Versions |
| --------- | ------------ | ---------------- |
| [🟢 scs-0001](/standards/global/scs-0001) | Sovereign Cloud Standards | [v1](/standards/scs-0001-v1-sovereign-cloud-standards) |
| [🟢 scs-0002](/standards/global/scs-0002) | SCS Documentation structure | [v1](/standards/scs-0002-v1-standards-docs-org) |
| [🟠 scs-0003](/standards/global/scs-0003) | Sovereign Cloud Standards YAML | |
| [🟢 scs-0001](/standards/global/scs-0001) | Sovereign Cloud Standards | [v1](/standards/scs-0001-v1-sovereign-cloud-standards) |
| [🟢 scs-0002](/standards/global/scs-0002) | SCS Documentation structure | [v1](/standards/scs-0002-v1-standards-docs-org) |
| [🟠 scs-0003](/standards/global/scs-0003) | Sovereign Cloud Standards YAML | |
2 changes: 1 addition & 1 deletion standards/global/scs-0001.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ SCS-0001 outlines the structure, requirements, and lifecycle of standards, proce

| Version | Type | State | stabilized | obsoleted |
| -------- | ----- | ------- | ---------- | --------- |
| [🟢 scs-0001-v1](/standards/scs-0001-v1-sovereign-cloud-standards) | Procedural | Stable | 2022-11-28 | - |
| [🟢 scs-0001-v1](/standards/scs-0001-v1-sovereign-cloud-standards) | Procedural | Stable | 2022-11-28 | - |
4 changes: 2 additions & 2 deletions standards/global/scs-0002.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ SCS-0002 standard outlines the standardized structure and maintenance processes

| Version | Type | State | stabilized | obsoleted |
| -------- | ----- | ------- | ---------- | --------- |
| [🟢 scs-0002-v1](/standards/scs-0002-v1-standards-docs-org) | Procedural | Stable | 2023-02-06 | - |
| [🟠 scs-0002-v2](/standards/scs-0002-v2-standards-docs-org) | Procedural | Draft | - | - |
| [🟢 scs-0002-v1](/standards/scs-0002-v1-standards-docs-org) | Procedural | Stable | 2023-02-06 | - |
| [🟠 scs-0002-v2](/standards/scs-0002-v2-standards-docs-org) | Procedural | Draft | - | - |
2 changes: 1 addition & 1 deletion standards/global/scs-0003.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ SCS-0003 outlines the standards and certification processes for interoperable an

| Version | Type | State | stabilized | obsoleted |
| -------- | ----- | ------- | ---------- | --------- |
| [🟠 scs-0003-v1](/standards/scs-0003-v1-sovereign-cloud-standards-yaml) | Procedural | Draft | - | - |
| [🟠 scs-0003-v1](/standards/scs-0003-v1-sovereign-cloud-standards-yaml) | Procedural | Draft | - | - |
16 changes: 8 additions & 8 deletions standards/iaas/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ The IaaS Layer Standards track focuses on the protocols, guidelines, and specifi

| Standard | Description | Active Versions |
| --------- | ------------ | ---------------- |
| [🟢 scs-0100](/standards/iaas/scs-0100) | SCS Flavor Naming Standard | [v3](/standards/scs-0100-v3-flavor-naming) |
| [🟠 scs-0101](/standards/iaas/scs-0101) | SCS Entropy | |
| [🟢 scs-0102](/standards/iaas/scs-0102) | SCS Image Metadata Standard | [v1](/standards/scs-0102-v1-image-metadata) |
| [🟠 scs-0103](/standards/iaas/scs-0103) | SCS Standard Flavors and Properties | |
| [🟠 scs-0104](/standards/iaas/scs-0104) | SCS Standard Images | |
| [🟢 scs-0110](/standards/iaas/scs-0110) | SSD Flavors | [v1](/standards/scs-0110-v1-ssd-flavors) |
| [🟠 scs-0111](/standards/iaas/scs-0111) | Decisions for the Volume Type Standard | |
| [🟠 scs-0412](/standards/iaas/scs-0412) | Exposition of IaaS metering data as JSON | |
| [🟢 scs-0100](/standards/iaas/scs-0100) | SCS Flavor Naming Standard | [v3](/standards/scs-0100-v3-flavor-naming) |
| [🟠 scs-0101](/standards/iaas/scs-0101) | SCS Entropy | |
| [🟢 scs-0102](/standards/iaas/scs-0102) | SCS Image Metadata Standard | [v1](/standards/scs-0102-v1-image-metadata) |
| [🟠 scs-0103](/standards/iaas/scs-0103) | SCS Standard Flavors and Properties | |
| [🟠 scs-0104](/standards/iaas/scs-0104) | SCS Standard Images | |
| [🟢 scs-0110](/standards/iaas/scs-0110) | SSD Flavors | [v1](/standards/scs-0110-v1-ssd-flavors) |
| [🟠 scs-0111](/standards/iaas/scs-0111) | Decisions for the Volume Type Standard | |
| [🟠 scs-0412](/standards/iaas/scs-0412) | Exposition of IaaS metering data as JSON | |
4 changes: 2 additions & 2 deletions standards/iaas/scs-0100.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ The SCS Flavor Naming Standard provides a systematic approach for naming instanc

| Version | Type | State | stabilized | obsoleted |
| -------- | ----- | ------- | ---------- | --------- |
| [🟠 scs-0100-v2](/standards/scs-0100-v2-flavor-naming) | Standard | Draft | - | - |
| [🟢 scs-0100-v3](/standards/scs-0100-v3-flavor-naming) | Standard | Stable | 2023-06-14 | - |
| [🟠 scs-0100-v2](/standards/scs-0100-v2-flavor-naming) | Standard | Draft | - | - |
| [🟢 scs-0100-v3](/standards/scs-0100-v3-flavor-naming) | Standard | Stable | 2023-06-14 | - |
2 changes: 1 addition & 1 deletion standards/iaas/scs-0101.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ The SCS-0101 Entropy Standard ensures adequate entropy is available in virtual i

| Version | Type | State | stabilized | obsoleted |
| -------- | ----- | ------- | ---------- | --------- |
| [🟠 scs-0101-v1](/standards/scs-0101-v1-entropy) | Standard | Draft | - | - |
| [🟠 scs-0101-v1](/standards/scs-0101-v1-entropy) | Standard | Draft | - | - |
2 changes: 1 addition & 1 deletion standards/iaas/scs-0102.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ The SCS-0102 Image Metadata Standard outlines how to categorize and manage metad

| Version | Type | State | stabilized | obsoleted |
| -------- | ----- | ------- | ---------- | --------- |
| [🟢 scs-0102-v1](/standards/scs-0102-v1-image-metadata) | Standard | Stable | 2022-10-31 | - |
| [🟢 scs-0102-v1](/standards/scs-0102-v1-image-metadata) | Standard | Stable | 2022-10-31 | - |
2 changes: 1 addition & 1 deletion standards/iaas/scs-0103.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ The SCS-0103 standard outlines mandatory and recommended specifications for flav

| Version | Type | State | stabilized | obsoleted |
| -------- | ----- | ------- | ---------- | --------- |
| [🟠 scs-0103-v1](/standards/scs-0103-v1-standard-flavors) | Standard | Draft | - | - |
| [🟠 scs-0103-v1](/standards/scs-0103-v1-standard-flavors) | Standard | Draft | - | - |
2 changes: 1 addition & 1 deletion standards/iaas/scs-0104.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ The SCS-0104 standard establishes guidelines for virtual machine images in Sover

| Version | Type | State | stabilized | obsoleted |
| -------- | ----- | ------- | ---------- | --------- |
| [🟠 scs-0104-v1](/standards/scs-0104-v1-standard-images) | Standard | Draft | - | - |
| [🟠 scs-0104-v1](/standards/scs-0104-v1-standard-images) | Standard | Draft | - | - |
6 changes: 3 additions & 3 deletions standards/iam/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ This track revolves around Identity and Access Management (IAM) standards, provi

| Standard | Description | Active Versions |
| --------- | ------------ | ---------------- |
| [🟢 scs-0300](/standards/iam/scs-0300) | Requirements for SSO identity federation | [v1](/standards/scs-0300-v1-requirements-for-sso-identity-federation) |
| [🟠 scs-0301](/standards/iam/scs-0301) | Recommended naming for domains/groups/roles/project when onboarding new customers | |
| [🟠 scs-0302](/standards/iam/scs-0302) | Domain Manager configuration for Keystone | |
| [🟢 scs-0300](/standards/iam/scs-0300) | Requirements for SSO identity federation | [v1](/standards/scs-0300-v1-requirements-for-sso-identity-federation) |
| [🟠 scs-0301](/standards/iam/scs-0301) | Recommended naming for domains/groups/roles/project when onboarding new customers | |
| [🟠 scs-0302](/standards/iam/scs-0302) | Domain Manager configuration for Keystone | |
2 changes: 1 addition & 1 deletion standards/iam/scs-0300.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ The SCS-0300 standard outlines requirements for Single Sign-On (SSO) identity fe

| Version | Type | State | stabilized | obsoleted |
| -------- | ----- | ------- | ---------- | --------- |
| [🟢 scs-0300-v1](/standards/scs-0300-v1-requirements-for-sso-identity-federation) | Decision Record | Stable | 2023-06-21 | - |
| [🟢 scs-0300-v1](/standards/scs-0300-v1-requirements-for-sso-identity-federation) | Decision Record | Stable | 2023-06-21 | - |
10 changes: 5 additions & 5 deletions standards/kaas/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Standards in this track are concerned with Kubernetes as a Service layer, outlin

| Standard | Description | Active Versions |
| --------- | ------------ | ---------------- |
| [🟢 scs-0210](/standards/kaas/scs-0210) | SCS K8S Version Policy | [v1](/standards/scs-0210-v1-k8s-new-version-policy) |
| [🟢 scs-0211](/standards/kaas/scs-0211) | SCS KaaS default storage class | [v1](/standards/scs-0211-v1-kaas-default-storage-class) |
| [🟠 scs-0212](/standards/kaas/scs-0212) | Requirements for container registry | |
| [🟠 scs-0213](/standards/kaas/scs-0213) | Kubernetes Nodes Anti Affinity | |
| [🟠 scs-0214](/standards/kaas/scs-0214) | Kubernetes Node Distribution and Availability | |
| [🟢 scs-0210](/standards/kaas/scs-0210) | SCS K8S Version Policy | [v1](/standards/scs-0210-v1-k8s-new-version-policy) |
| [🟢 scs-0211](/standards/kaas/scs-0211) | SCS KaaS default storage class | [v1](/standards/scs-0211-v1-kaas-default-storage-class) |
| [🟠 scs-0212](/standards/kaas/scs-0212) | Requirements for container registry | |
| [🟠 scs-0213](/standards/kaas/scs-0213) | Kubernetes Nodes Anti Affinity | |
| [🟠 scs-0214](/standards/kaas/scs-0214) | Kubernetes Node Distribution and Availability | |
4 changes: 2 additions & 2 deletions standards/kaas/scs-0210.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ The SCS-0210 standard outlines the expected pace at which providers should adopt

| Version | Type | State | stabilized | obsoleted |
| -------- | ----- | ------- | ---------- | --------- |
| [🟢 scs-0210-v1](/standards/scs-0210-v1-k8s-new-version-policy) | Standard | Stable | 2023-02-07 | - |
| [🟠 scs-0210-v2](/standards/scs-0210-v2-k8s-version-policy) | Standard | Draft | - | - |
| [🟢 scs-0210-v1](/standards/scs-0210-v1-k8s-new-version-policy) | Standard | Stable | 2023-02-07 | - |
| [🟠 scs-0210-v2](/standards/scs-0210-v2-k8s-version-policy) | Standard | Draft | - | - |
2 changes: 1 addition & 1 deletion standards/kaas/scs-0211.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ The SCS-0211 standard outlines the properties required for the default StorageCl

| Version | Type | State | stabilized | obsoleted |
| -------- | ----- | ------- | ---------- | --------- |
| [🟢 scs-0211-v1](/standards/scs-0211-v1-kaas-default-storage-class) | Standard | Stable | 2023-02-13 | - |
| [🟢 scs-0211-v1](/standards/scs-0211-v1-kaas-default-storage-class) | Standard | Stable | 2023-02-13 | - |
10 changes: 5 additions & 5 deletions standards/ops/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Operational Tooling Standards cover the protocols and guidelines associated with

| Standard | Description | Active Versions |
| --------- | ------------ | ---------------- |
| [🟠 scs-0400](/standards/ops/scs-0400) | Status Page create decision | |
| [🟠 scs-0401](/standards/ops/scs-0401) | Status page reference implementation decision | |
| [🟠 scs-0402](/standards/ops/scs-0402) | Status page OpenAPI decision | |
| [🟠 scs-0410](/standards/ops/scs-0410) | Gnocchi as database for metering | |
| [🟠 scs-0411](/standards/ops/scs-0411) | Push-based approach for providing usage data | |
| [🟠 scs-0400](/standards/ops/scs-0400) | Status Page create decision | |
| [🟠 scs-0401](/standards/ops/scs-0401) | Status page reference implementation decision | |
| [🟠 scs-0402](/standards/ops/scs-0402) | Status page OpenAPI decision | |
| [🟠 scs-0410](/standards/ops/scs-0410) | Gnocchi as database for metering | |
| [🟠 scs-0411](/standards/ops/scs-0411) | Push-based approach for providing usage data | |
Loading

0 comments on commit 19d66f9

Please sign in to comment.