Skip to content

Commit

Permalink
update examples with new action definition
Browse files Browse the repository at this point in the history
  • Loading branch information
kristofferlind committed Nov 13, 2022
1 parent b98a591 commit b18b547
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 75 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Minimalist cli tool for building many similar components in a monorepo. Calculates a hash of the file content of a component and checks for existing artifacts with that hash to determine whether to build the component.

### Example configurations
Example configurations can be found in [examples/](./examples), [.knega.root.yml](./examples/.knega.root.yml) should be at project root and [.component.yml](./examples/.component.yml) should exist for every component you want to include in an action. Check [examples/full](./examples/full/) for an example with sample components (used by tests).
Example configurations can be found in [examples/](./examples), [.knega.root.yml](./examples/.knega.root.yml) should be at project root and [.component.yml](./examples/components/example-1/.component.yml) should exist for every component you want to include in an action.

## Installation
Download fom releases, unpack and execute. Linux example:
Expand Down
15 changes: 0 additions & 15 deletions examples/.component.yml

This file was deleted.

38 changes: 8 additions & 30 deletions examples/.knega.root.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,23 @@
# Defines where to look for components
componentPaths: ["services", "libraries"]

# how many levels below component paths to search
componentPaths: ["components"]
componentSearchDepth: 2

# how many threads to run
concurrency: 2

# Default configuration for components, overriding a top level property is a replace
defaultConfiguration:
# inputs define paths to files whose content will be summed into $INPUTS_HASH per component
inputs:
- type: "Files"
paths: ["$ROOT/.knega.root.yml"]
# git ls files *
- type: "GitFiles"
paths: ["*"]

# outputs define artifacts to check, if all artifacts the action can be skipped for that component with knega changed <action>
outputs:
# Docker image example
- type: "OCI"
repository: "some-registry.com/some-category/$COMPONENT_NAME"
repository: "localhost:5000/$COMPONENT_NAME"
tag: "$INPUTS_HASH"
# Helm chart example
- type: "OCI"
repository: "some-registry.com/charts/some-category/$COMPONENT_NAME"
# chart version needs to comply with semver
tag: "1.0.0-$INPUTS_HASH"

# actions define collections of commands to be executed with knega changed/all <action>
actions:
# name defines command name, ie knega changed build in this case
- name: "build"
# commands are executed with component directory as working directory, root scripts can be run using $ROOT
# $ROOT, $COMPONENT_NAME and $INPUTS_HASH available as environment variables during execution
commands: [
"$ROOT/scripts/build.sh
]
# example knega all release to execute these commands for all components
- name: "release"
commands: [
"$ROOT/scripts/release.sh
]
build:
commands:
# - 'echo "Component name: $COMPONENT_NAME"'
# - 'echo "Root path: $ROOT"'
# - 'echo "Inputs hash: $INPUTS_HASH"'
- $ROOT/scripts/build.sh
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions examples/components/test-no-build-1/.component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: "test-no-build-1"

actions:
build:
commands: []
test:
commands:
- 'echo "test action executed in $COMPONENT_NAME"'
10 changes: 10 additions & 0 deletions examples/components/test-no-outputs-1/.component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: "test-no-output-1"

outputs: []

actions:
build:
commands: []
test:
commands:
- 'echo "test action executed in $COMPONENT_NAME"'
6 changes: 6 additions & 0 deletions examples/components/with-test-1/.component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: "with-test-1"

actions:
test:
commands:
- 'echo "test action executed in $COMPONENT_NAME"'
1 change: 1 addition & 0 deletions examples/components/with-test-1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM alpine
23 changes: 0 additions & 23 deletions examples/full/.knega.root.yml

This file was deleted.

6 changes: 0 additions & 6 deletions examples/full/components/test-only-1/.component.yml

This file was deleted.

File renamed without changes.

0 comments on commit b18b547

Please sign in to comment.