Skip to content

Commit 61053d2

Browse files
authored
Merge pull request #16 from bbc/sammg-markdown-linting
Add CI linting for Markdown files
2 parents f8edac7 + 48a9f03 commit 61053d2

File tree

8 files changed

+99
-23
lines changed

8 files changed

+99
-23
lines changed

.github/workflows/ci-workflow.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ jobs:
3030
with:
3131
fetch-depth: 0 # check out the entire repo history for SHA verification in lastSuccessful step
3232

33+
- name: Lint Markdown docs
34+
run: make lint-markdown
35+
3336
- name: Lint specification
34-
run: make lint
35-
working-directory: ./api
37+
run: make lint-apispec
3638

3739
- name: Render API docs
3840
run: make render

.markdownlint-cli2.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
globs:
3+
- '**/*.md'
4+
5+
ignores:
6+
- 'LICENCE.md'
7+
- 'ICLA.md'
8+
- '.github/'
9+
10+
default: true
11+
12+
config:
13+
default: true
14+
15+
# Allow arbitrary line length
16+
MD013: false
17+
18+
# Allow duplicate headings
19+
MD024: false
20+
21+
customRules:
22+
- markdownlint-rule-max-one-sentence-per-line # Enforce one-sentence-per-line using custom rule

CONTRIBUTING.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
11
# Contributing
2-
Thank you for your interest in our work. If you're more generally interested in our Time Addressable Media Stores work, the implementations we've built internally or opportunities for collaboration, please reach out to us at <[email protected]>
2+
3+
Thank you for your interest in our work.
4+
If you're more generally interested in our Time Addressable Media Stores work, the implementations we've built internally or opportunities for collaboration, please reach out to us at <[email protected]>
35

46
## API Improvements
5-
We welcome suggestions for changes and improvements to the API. Feel free to reach out using the email address above, or alternatively open a GitHub Issue.
7+
8+
We welcome suggestions for changes and improvements to the API.
9+
Feel free to reach out using the email address above, or alternatively open a GitHub Issue.
610

711
## Submitting Changes
8-
If you've fixed a problem or thought of an improvement, feel free to fork the repository and submit a Pull Request in the usual way. The process is:
12+
13+
If you've fixed a problem or thought of an improvement, feel free to fork the repository and submit a Pull Request in the usual way.
14+
The process is:
915

1016
1. Fork the repository
1117
2. For more significant changes, consider starting with writing an ADR document: see [the ADR readme](./docs/adr/decisions/README.md) for more
1218
3. Make, commit and push changes to a branch on your fork (make sure the commit message contains your email address)
1319
4. If you haven't already done so, sign the CLA (see below)
14-
5. Open a Pull Request with your changes. Don't worry about leaving empty spaces on the PR template (it's aimed at internal contributions), just fill in the description
20+
5. Open a Pull Request with your changes.
21+
Don't worry about leaving empty spaces on the PR template (it's aimed at internal contributions), just fill in the description
1522

1623
## Contributor Licence Agreement (CLA)
24+
1725
We desire that contributors of pull requests have signed, and submitted by email, an [Individual Contributor Licence Agreement (ICLA)](./ICLA.md), which is based on the Apache CLA.
1826

1927
The purpose of this agreement is to clearly define the terms under which intellectual property has been contributed to the BBC and thereby allow us to defend the project should there be a legal dispute regarding the software at some future time.

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
NUM_OF_PARENT:=$(shell echo $$(( $(words $(MAKEFILE_LIST)))) )
2+
topdir:=$(realpath $(dir $(word $(NUM_OF_PARENT),$(MAKEFILE_LIST))))
13

24
all: help
35

@@ -10,10 +12,19 @@ mock-server-up:
1012
mock-server-down:
1113
$(MAKE) -C api/ $@
1214

15+
lint-markdown:
16+
docker run -v ${topdir}:/workdir davidanson/markdownlint-cli2-rules:v0.12.1
17+
18+
lint-apispec:
19+
$(MAKE) -C api/ lint
20+
21+
lint: lint-markdown lint-apispec
22+
1323
help:
1424
@echo "tams-api"
1525
@echo "make render - Generate HTML rendered version of OpenAPI document"
1626
@echo "make mock-server-up - Start a mock API server on http://localhost:4010"
1727
@echo "make mock-server-down - Stop the mock API server"
28+
@echo "make lint - Lint API specification document and Markdown files"
1829

1930
.PHONY: help render mock-server-up mock-server-down

README.md

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Time-addressable Media Store API
2+
23
This repository contains API definitions for a Time-addressable Media Store (TAMS) server, which can be used to store, query and access segmented media - distinct from files and streams, but sharing characteristics of both.
34

45
BBC R&D have demonstrated use of the TAMS approach as part of composable, software-defined workflows which can run in the cloud, on-premise or in a hybrid environment.
@@ -26,33 +27,48 @@ Media can be moved between locations and storage tiers as needed.
2627
Users of TAMS are insulated from the details of the underlying storage.
2728

2829
## Documentation
30+
2931
- OpenAPI Specification: [TimeAddressableMediaStore.yaml](./api/TimeAddressableMediaStore.yaml)
3032
- Rendered Documentation: [https://bbc.github.io/tams](https://bbc.github.io/tams)
3133

32-
This repo contains some automation to run a mock version of the API using [Stoplight Prism](https://stoplight.io/open-source/prism). To run the mock server using Docker, try something like the command below (or run `make mock-server-up`):
33-
```
34+
This repo contains some automation to run a mock version of the API using [Stoplight Prism](https://stoplight.io/open-source/prism).
35+
To run the mock server using Docker, try something like the command below (or run `make mock-server-up`):
36+
37+
```shell
3438
docker run --rm --init --name mock-tams -v "$(pwd)":/data:ro -p 4010:4010 stoplight/prism mock /data/TimeAddressableMediaStore.yaml -h 0.0.0.0
3539
```
3640

3741
A mock API server will start at <http://localhost:4010>
3842

3943
## Design
40-
The store handles Flows which exist on an infinite timeline, are immutable, and can be grouped by Sources (based on the Flows and Sources in the [AMWA NMOS MS-04 model](https://specs.amwa.tv/ms-04/releases/v1.0.0/docs/2.1._Summary_and_Definitions.html)). A flow ID and timerange refers to a sequence of grains (_e.g._ frames of video or set of audio samples) and any point in a Flow can be uniquely addressed by a `<flow_id, timestamp>` tuple. This unique address is guaranteed to refer to a specific frame, or set of audio samples, so it can be safely passed around other tools or programs. At any time the unique address can be exchanged for the media data by an API call. But if that is not needed, media work can be done purely by reference.
4144

42-
Grains are grouped into Flow Segments, containing for example one second of content, wrapped in a container format such as MPEG-TS. The store provides a mechanism to upload and register new segments, and an interface to request all the segments covering a particular timerange and their download URLs; an approach inspired by chunked streaming protocols like HTTP Live Streaming.
45+
The store handles Flows which exist on an infinite timeline, are immutable, and can be grouped by Sources (based on the Flows and Sources in the [AMWA NMOS MS-04 model](https://specs.amwa.tv/ms-04/releases/v1.0.0/docs/2.1._Summary_and_Definitions.html)).
46+
A flow ID and timerange refers to a sequence of grains (_e.g._ frames of video or set of audio samples) and any point in a Flow can be uniquely addressed by a `<flow_id, timestamp>` tuple.
47+
This unique address is guaranteed to refer to a specific frame, or set of audio samples, so it can be safely passed around other tools or programs.
48+
At any time the unique address can be exchanged for the media data by an API call.
49+
But if that is not needed, media work can be done purely by reference.
50+
51+
Grains are grouped into Flow Segments, containing for example one second of content, wrapped in a container format such as MPEG-TS.
52+
The store provides a mechanism to upload and register new segments, and an interface to request all the segments covering a particular timerange and their download URLs; an approach inspired by chunked streaming protocols like HTTP Live Streaming.
4353

44-
Segments may be stored separately from the metadata linking them to a position on the timeline, separating the metadata and data planes. For example our implementation uses an object store (_e.g._ AWS S3) for the segments, passing S3 URLs to the client to upload directly and taking advantage of the scalability of cloud object storage. Segments are also de-coupled from their point in the timeline by a link between their `<flow_id, timestamp>` tuple and the underlying object ID, so a single segment can appear at multiple points in multiple flows. This allows for copy-on-write semantics: immutability means a new Flow must be created to make changes to existing parts of the timeline, but for unmodified portions of the timeline the new `<flow_id, timestamp>` tuple points to the existing object ID.
54+
Segments may be stored separately from the metadata linking them to a position on the timeline, separating the metadata and data planes.
55+
For example our implementation uses an object store (_e.g._ AWS S3) for the segments, passing S3 URLs to the client to upload directly and taking advantage of the scalability of cloud object storage.
56+
Segments are also de-coupled from their point in the timeline by a link between their `<flow_id, timestamp>` tuple and the underlying object ID, so a single segment can appear at multiple points in multiple flows.
57+
This allows for copy-on-write semantics: immutability means a new Flow must be created to make changes to existing parts of the timeline, but for unmodified portions of the timeline the new `<flow_id, timestamp>` tuple points to the existing object ID.
4558

4659
The Flow model is aligned with the principles and schemas of [AMWA NMOS IS-04](https://specs.amwa.tv/is-04/releases/v1.3.2/APIs/schemas/) to facilitate easy integration of NMOS-compliant media devices.
4760

4861
### Reading and Writing in the Store
62+
4963
The process of reading from the store is:
64+
5065
1. Client identifies the Flow ID and timerange of interest
5166
2. Client makes a request to [`GET flows/<flow_id>/segments?timerange=<timerange>`](https://bbc.github.io/tams/#/operations/GET_flows-flowId-segments) and receives a list of segments, timeranges and download URLs
5267
3. Client downloads each URL, concatenates the segments together and unwraps the grains within
5368
4. The first and last Flow Segment may contain more grains than requested, so the client should skip any received not in the requested timerange
5469

5570
The process of writing to the store is:
71+
5672
1. Client creates a Flow if necessary by making a request to [`PUT flows/<flow_id>`](https://bbc.github.io/tams/#/operations/PUT_flows-flowId)
5773
2. Client makes a request to [`POST flows/<flow_id>/storage`](https://bbc.github.io/tams/#/operations/POST_flows-flowId-storage) with the timerange to be written
5874
3. Store responds with a list of segment timeranges and URLs to PUT segments to, along with an optional `pre` URL to call before writing
@@ -61,16 +77,27 @@ The process of writing to the store is:
6177
6. Client makes requests to [`POST flows/<flow_id>/segments`](https://bbc.github.io/tams/#/operations/POST_flows-flowId-segments) with details of each new segment created, to register them on the timeline
6278

6379
### Flows, Sources and Mutation
64-
Flows in the store are assumed to be immutable: once a grain has been written to a point on the timeline on a specific Flow, it cannot be changed. However Flows can always be extended, with empty spaces on the timeline filled in, and areas of the timeline can be permanently erased.
6580

66-
When it becomes necessary to mutate content, for example reversioning content or performing production operations, the Flow ID (and potentially Source ID) will change. Various scenarios are explored in the [Practical Guidance for Media](https://specs.amwa.tv/ms-04/releases/v1.0.0/docs/3.0._Practical_Guidance_for_Media.html) section of AMWA MS-04.
81+
Flows in the store are assumed to be immutable: once a grain has been written to a point on the timeline on a specific Flow, it cannot be changed.
82+
However Flows can always be extended, with empty spaces on the timeline filled in, and areas of the timeline can be permanently erased.
83+
84+
When it becomes necessary to mutate content, for example reversioning content or performing production operations, the Flow ID (and potentially Source ID) will change.
85+
Various scenarios are explored in the [Practical Guidance for Media](https://specs.amwa.tv/ms-04/releases/v1.0.0/docs/3.0._Practical_Guidance_for_Media.html) section of AMWA MS-04.
6786

6887
### API Versioning
69-
The API is versioned using a major and minor version number. A breaking change results in a major version increment and the minor version is reset to 0. Features such new endpoints or new (optional) data properties result in a minor version increment. Other changes such as bug fixes and documentation changes do not result in version updates. Note that the version may change frequently whilst the API is still under development!
88+
89+
The API is versioned using a major and minor version number.
90+
A breaking change results in a major version increment and the minor version is reset to 0.
91+
Features such new endpoints or new (optional) data properties result in a minor version increment.
92+
Other changes such as bug fixes and documentation changes do not result in version updates.
93+
Note that the version may change frequently whilst the API is still under development!
7094

7195
## Proposals, Decisions and Architecture Changes
72-
This repository uses [(M)ADR documents](https://adr.github.io/madr/) to propose significant changes, facilitate discussions and decision making, and to store a record of options that were considered.
96+
97+
This repository uses [(M)ADR documents](https://adr.github.io/madr/) to propose significant changes, facilitate discussions and decision making, and to store a record of options that were considered.
7398
These documents may be found in the [docs/adr/decisions](./docs/adr/decisions/) directory, and are managed as described by the [ADR Readme](./docs/adr/decisions/README.md).
7499

75100
## Get in touch
76-
If you'd like to know more about our work on TAMS, talk about our implementations or start a collaboration, contact us on <[email protected]>. Also see [CONTRIBUTING.md](./CONTRIBUTING.md) for more about how to make contributions.
101+
102+
If you'd like to know more about our work on TAMS, talk about our implementations or start a collaboration, contact us on <[email protected]>.
103+
Also see [CONTRIBUTING.md](./CONTRIBUTING.md) for more about how to make contributions.

docs/adr/decisions/0000-use-markdown-adrs-to-record-design-decisions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ It's also beneficial to anyone involved in the collaborative development of the
2525
## Decision Outcome
2626

2727
Chosen option: "Use (M)ADR documents, one per decision", because
28-
Meets all of the requirements. Could be supplemented with use of Issues and/or Discussions if/when the need arises, but these serve slightly different purposes.
28+
Meets all of the requirements.
29+
Could be supplemented with use of Issues and/or Discussions if/when the need arises, but these serve slightly different purposes.
2930

3031
### Consequences
3132

@@ -35,7 +36,7 @@ Meets all of the requirements. Could be supplemented with use of Issues and/or D
3536

3637
### Implementation
3738

38-
Implemented by https://github.com/bbc/tams/pull/15/
39+
Implemented by <https://github.com/bbc/tams/pull/15/>
3940

4041
## Pros and Cons of the Alternative Options
4142

@@ -50,4 +51,3 @@ It was felt that GitHub Discussions, whilst a potentially useful adjunct to ADRs
5051
### Use some combination of the considered options
5152

5253
This will be kept under review, and other mechanisms may be introduced to support the use of ADRs
53-

docs/adr/decisions/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,38 @@ This directory contains decision records for the TAMS API, describing the ration
44
They exist to describe proposals, to facilitate discussions and decision making, and to serve as a concise record of those discussions.
55
The full list is located as Markdown files [in this directory](./).
66

7-
These records are based on the Markdown Any Decision Record template - see https://github.com/adr/madr for the original template, and <https://adr.github.io/> for more on ADRs in general.
7+
These records are based on the Markdown Any Decision Record template - see <https://github.com/adr/madr> for the original template, and <https://adr.github.io/> for more on ADRs in general.
88

99
ADRs will be submitted using GitHub PRs, which provides necessary tooling for community review and approval.
1010
Not all changes to the API definition will warrant an ADR.
1111
One of the tests that will need to be applied on review of PRs containing ADR docs, and PRs that don't, is that of architectural significance.
1212

1313
## Creating a new ADR
14+
1415
0. Look at the existing list of ADRs, and see if this has been considered before, or whether it would supersede any of them
1516
1. Copy the [adr-template.md](../template/adr-template.md) into this directory
1617
2. Name it with the next number in sequence, and a sensible title (e.g. `00023-improve-source-hierarchy.md`)
17-
3. Fill in the template: at least the "Context", "Considered Options" and "Pros and Cons..." sections. Feel free to choose a preferred option and add it to the "Decision Outcome" section as well.
18+
3. Fill in the template: at least the "Context", "Considered Options" and "Pros and Cons..." sections.
19+
Feel free to choose a preferred option and add it to the "Decision Outcome" section as well.
1820
4. If making the proposed changes (e.g. to the API, schemas or examples) helps to explain your proposal, make those changes as well
1921
5. Open a PR with your MADR document and any other changes
2022

2123
## Reviewing the proposal
24+
2225
During the review process, use PR comments to ask questions, make suggestions or generally discuss the proposal.
2326
Alternatively, if a synchronous discussion takes place (e.g. an in-person or online meeting), add a description of what was discussed and the outcome into the ADR document itself.
2427

2528
Generally PRs should remain open for review for a period of time to invite comments from the wider TAMS community, and if necessary PRs should be circulated to interested individuals.
2629
The maintainers at BBC R&D will facilitate this process, and expedite it if necessary
2730

2831
## Finishing and merging
32+
2933
Once the review process has completed and a consensus has been reached:
34+
3035
1. Amend the ADR document with relevant points from the review discussion, and changes to the decision if necessary
3136
2. Try to make these changes with new commits, so it's possible to see the original version in the Git history
32-
3. If you added an implementation at the same time, make the required changes there too. Rememeber to bump the API version in accordance with [the README](../../../README.md#api-versioning)
37+
3. If you added an implementation at the same time, make the required changes there too.
38+
Rememeber to bump the API version in accordance with [the README](../../../README.md#api-versioning)
3339
4. Amend the ADR status to "accepted"
3440
5. Consider whether your rework would benefit from someone else looking over it
3541
6. Merge the PR

docs/adr/template/adr-template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ status: "{proposed | rejected | accepted | deprecated | … | superseded by [ADR
2525
## Decision Outcome
2626

2727
Chosen option: "{title of option 1}", because
28-
{justification. e.g., only option, which meets k.o. criterion decision driver | which resolves force {force} | … | comes out best (see below)}.
28+
{Justification, e.g., only option which resolves requirements, or comes out best (see below)}.
2929

3030
<!-- This is an optional element. Feel free to remove. -->
3131
### Consequences

0 commit comments

Comments
 (0)