Skip to content

Commit

Permalink
chore: import schema files and update ci (score-spec#103)
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Meier <ben.meier@humanitec.com>
  • Loading branch information
astromechza authored Aug 8, 2024
1 parent a7389d1 commit f4dab8b
Show file tree
Hide file tree
Showing 17 changed files with 547 additions and 119 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/linkchecker.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "Code Quality: Link Checker"
name: "CI"

on:
pull_request:
Expand All @@ -18,3 +18,13 @@ jobs:
fail: true
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.22"

- name: Check Schema
env:
GOPATH: /home/runner/work/go
run: make test
47 changes: 47 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Disable all the default make stuff
MAKEFLAGS += --no-builtin-rules
.SUFFIXES:

SCORE_EXAMPLES_DIR ?= ./samples

## Display help menu
.PHONY: help
help:
@echo Documented Make targets:
@perl -e 'undef $$/; while (<>) { while ($$_ =~ /## (.*?)(?:\n# .*)*\n.PHONY:\s+(\S+).*/mg) { printf "\033[36m%-30s\033[0m %s\n", $$2, $$1 } }' $(MAKEFILE_LIST) | sort

# ------------------------------------------------------------------------------
# NON-PHONY TARGETS
# ------------------------------------------------------------------------------

${GOPATH}/bin/jv:
ifeq ($(GOPATH),)
$(error GOPATH must be set)
endif
go install github.com/santhosh-tekuri/jsonschema/cmd/jv@latest

# ------------------------------------------------------------------------------
# PHONY TARGETS
# ------------------------------------------------------------------------------

.PHONY: .ALWAYS
.ALWAYS:

## Test that the score schema matches the json-schema reference
.PHONY: test-schema
test-schema: ${GOPATH}/bin/jv
${GOPATH}/bin/jv --assert-format --assert-content https://json-schema.org/draft/2020-12/schema ./score-v1b1.json
@echo "Schema is a valid jsonschema"

## Test that the given score examples in $SCORE_EXAMPLES_DIR match the schema
.PHONY: test-examples
test-examples: ${GOPATH}/bin/jv
ifeq ($(SCORE_EXAMPLES_DIR),)
$(error SCORE_EXAMPLES_DIR must be set)
endif
find ${SCORE_EXAMPLES_DIR} -name 'score*.yaml' -print -exec ${GOPATH}/bin/jv --assert-format --assert-content ./score-v1b1.json {} \;
@echo "Schema matches all samples"

## Run all tests
.PHONY: test
test: test-schema test-examples
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
![Score banner](/docs/images/banner.png)

[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)

## ![Score](/docs/images/logo.svg) The Score Specification

Score is an open-source workload specification designed to simplify development for cloud-native developers. The specification enables you to describe your workload's configuration in a vendor-neutral way, eliminating the need for tooling-specific syntax from platforms such as Docker Compose or Kubernetes. By leveraging familiar concepts and semantics, defining a workload’s configuration becomes as simple as stating, “I want a database of type X and an event queue of type Y to accompany my workload”.
Expand Down Expand Up @@ -56,7 +59,7 @@ Looking at the example above, you'll notice that the Score specification is:

* **declarative**: With Score, developers declare what their workload requires to run as part of the Score specification. The platform in the target environment is responsible for resolving individual runtime requirements. This establishes a contract between dev and ops: If the requirements listed in the spec are honoured, the workload will run as intended.

The current version of the specification schema is stored [here](https://github.com/score-spec/schema/blob/main/score-v1b1.json). For a more detailed specification reference, check out our [developer documentation](https://docs.score.dev/docs/score-specification/score-spec-reference/).
The current version of the specification schema is stored [here](./score-v1b1.json). For a more detailed specification reference, check out our [developer documentation](https://docs.score.dev/docs/score-specification/score-spec-reference/).

## ![Score](/docs/images/logo.svg) Implementation of the Score Specification

Expand Down Expand Up @@ -112,11 +115,3 @@ See [Roadmap](roadmap.md). You can [submit an idea](https://github.com/score-spe
### Contribution Guidelines and Governance

Our general contributor guidelines can be found in [CONTRIBUTING.md](CONTRIBUTING.md). Please note that some repositories may have additional guidelines. For more information on our governance model, please refer to [GOVERNANCE.md](GOVERNANCE.md).

### License

[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

### Code of conduct

[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)
5 changes: 0 additions & 5 deletions docs/questions/README.md

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions docs/questions/how_do_I_install.question.md

This file was deleted.

7 changes: 0 additions & 7 deletions docs/questions/how_does_score_work.question.md

This file was deleted.

8 changes: 0 additions & 8 deletions docs/questions/how_is_score_platform_agnostic.question.md

This file was deleted.

8 changes: 0 additions & 8 deletions docs/questions/how_to_contanct.question.md

This file was deleted.

12 changes: 0 additions & 12 deletions docs/questions/what_do_I_need_to_know.question.md

This file was deleted.

8 changes: 0 additions & 8 deletions docs/questions/what_is_score.question.md

This file was deleted.

5 changes: 0 additions & 5 deletions docs/questions/whats_the_difference.question.md

This file was deleted.

13 changes: 0 additions & 13 deletions docs/questions/who_should_adopt_score.question.md

This file was deleted.

14 changes: 0 additions & 14 deletions docs/questions/why_should_I_use_score.question.md

This file was deleted.

5 changes: 0 additions & 5 deletions docs/questions/why_would_I_adpot_score.question.md

This file was deleted.

75 changes: 75 additions & 0 deletions samples/score-full.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
apiVersion: score.dev/v1b1
metadata:
name: example-workload-name123
extra-key: extra-value
annotations:
prefix.com/Another-Key_Annotation.2: something else
service:
ports:
port-one:
port: 1000
protocol: TCP
targetPort: 10000
port-two2:
port: 8000
containers:
container-one1:
image: localhost:4000/repo/my-image:tag
command: ["/bin/sh", "-c"]
args: ["hello", "world"]
resources:
requests:
cpu: 1000m
memory: 10Gi
limits:
cpu: "0.24"
memory: 128M
variables:
SOME_VAR: some content here
files:
- target: /my/file
mode: "0600"
source: file.txt
- target: /my/other/file
content: |
some multiline
content
volumes:
- source: volume-name
target: /mnt/something
path: /sub/path
readOnly: false
- source: volume-two
target: /mnt/something-else
livenessProbe:
httpGet:
port: 8080
path: /livez
readinessProbe:
httpGet:
host: 127.0.0.1
port: 80
scheme: HTTP
path: /readyz
httpHeaders:
- name: SOME_HEADER
value: some-value-here
container-two2:
image: .
resources:
resource-one1:
metadata:
annotations:
Default-Annotation: this is my annotation
prefix.com/Another-Key_Annotation.2: something else
extra-key: extra-value
type: Resource-One
class: default
params:
extra:
data: here
resource-two2:
type: Resource-Two
resource-three:
type: Type-Three
id: shared-type-three
Loading

0 comments on commit f4dab8b

Please sign in to comment.