Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/actions/extract-tag-info/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ runs:
TAG="${REF#refs/tags/}" # remove 'refs/tags/' prefix
VERSION="${TAG##*/}" # get last part after last slash

# Remove 'functions/' or 'contrib/functions/' prefix
# Remove 'functions/' prefix
PATH_WITHOUT_PREFIX="${TAG#functions/}"
PATH_WITHOUT_PREFIX="${PATH_WITHOUT_PREFIX#contrib/functions/}"

# Remove 'go/' prefix if present
IMAGE_NAME="${PATH_WITHOUT_PREFIX#go/}"
Expand All @@ -34,5 +33,5 @@ outputs:
description: "The extracted semantic version from the tag"
value: ${{ steps.extract.outputs.version }} # reference step id
image_name:
description: "The extracted image name (without functions/, contrib/functions/, or go/ prefixes)"
description: "The extracted image name (without functions/ or go/ prefixes)"
value: ${{ steps.extract.outputs.image_name }} # reference step id
26 changes: 3 additions & 23 deletions .github/workflows/after-push-to-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ on:
- "main"

jobs:
build-push-curated:
name: Build and push latest curated images
build-push:
name: Build and push latest images
runs-on: ubuntu-latest
permissions:
packages: write
Expand All @@ -40,24 +40,4 @@ jobs:
- name: Push latest and github-ref images
run: |
SHORT_SHA=$(git rev-parse --short HEAD)
make push-curated TAG=latest,$SHORT_SHA DEFAULT_CR=ghcr.io/${{ github.repository }}
build-push-contrib:
name: Build and push latest contrib images
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version-file: documentation/go.mod
cache: true
- uses: docker/setup-qemu-action@v4
- uses: docker/setup-buildx-action@v4
- name: Log in to GHCR
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push latest and github-ref images
run: |
SHORT_SHA=$(git rev-parse --short HEAD)
make push-contrib TAG=latest,$SHORT_SHA DEFAULT_CONTRIB_CR=ghcr.io/${{ github.repository }}/krm-fn-contrib
make push TAG=latest,$SHORT_SHA DEFAULT_CR=ghcr.io/${{ github.repository }}
7 changes: 1 addition & 6 deletions .github/workflows/after-tag-with-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ on:
push:
tags:
- "functions/*/*/v*"
- "contrib/functions/*/*/v*"

jobs:
build-push-release:
Expand Down Expand Up @@ -62,13 +61,9 @@ jobs:
IMAGE_NAME="${{ steps.extract.outputs.image_name }}"

if [[ "${GITHUB_REF#refs/tags/}" == functions/* ]]; then
echo "Detected curated functions release"
echo "Detected functions release"
cd functions/go
make func-push TAG=$VERSION CURRENT_FUNCTION=$IMAGE_NAME DEFAULT_CR=ghcr.io/${GITHUB_REPOSITORY}
elif [[ "${GITHUB_REF#refs/tags/}" == contrib/functions/* ]]; then
echo "Detected contrib functions release"
cd contrib/functions/go
make func-push TAG=$VERSION CURRENT_FUNCTION=$IMAGE_NAME DEFAULT_CR=ghcr.io/${GITHUB_REPOSITORY}/krm-fn-contrib
else
echo "Tag does not match any known type, skipping."
exit 0
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ on:
tags:
# e.g. functions/go/apply-setters/v1.1.1
- "functions/*/*/v[0-9]+.[0-9]+.[0-9]+"
- "contrib/functions/*/*/v[0-9]+.[0-9]+.[0-9]+"

jobs:
build:
Expand Down
20 changes: 6 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,14 @@ Contributions are required to follow these style guides:
### Repo Layout

```shell
├── examples: Home for all curated function examples
│ ├── curated_function_bar_example
│ └── curated_function_foo_example
├── examples: Home for all function examples
│ ├── function_bar_example
│ └── function_foo_example
├── functions
│ └── go: Home for all golang-based curated function source code
│ └── go: Home for all golang-based function source code
│ ├── Makefile
│ ├── curated_go_function_bar
│ └── curated_go_function_foo
├── contrib
│ ├── functions
│ │ └── go: Home for all golang-based contrib function source code
│ └── examples: Home for all contrib function examples.
│ ├── go_function_bar
│ └── go_function_foo
├── scripts
├── tests: Home for e2e tests
└── build
Expand Down Expand Up @@ -196,8 +192,6 @@ To test a specific example or the e2e test, run
```shell
$ cd tests/e2etest
$ go test -v ./... -run TestE2E/../../examples/$EXAMPLE_NAME
# To test the example in contrib
$ go test -v ./... -run TestE2E/../../contrib/examples/$EXAMPLE_NAME
```

If you encounter some test failure saying something like "actual diff doesn't
Expand All @@ -207,8 +201,6 @@ expected `diff.patch` or `results.yaml` by running the following commands:
```shell
# Update one example
$ KPT_E2E_UPDATE_EXPECTED=true go test -v ./... -run TestE2E/../../examples/$EXAMPLE_NAME
# Update one example in contrib
$ KPT_E2E_UPDATE_EXPECTED=true go test -v ./... -run TestE2E/../../contrib/examples/$EXAMPLE_NAME

# Update all examples
$ KPT_E2E_UPDATE_EXPECTED=true go test -v ./...
Expand Down
9 changes: 1 addition & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
SHELL=/bin/bash
export TAG ?= latest
export DEFAULT_CR ?= ghcr.io/kptdev/krm-functions-catalog
export DEFAULT_CONTRIB_CR ?= ghcr.io/kptdev/krm-functions-catalog/krm-fn-contrib


.DEFAULT_GOAL := help
Expand All @@ -26,7 +25,6 @@ help: ## Print this help

unit-test: ## Run unit tests for Go functions
cd functions/go && $(MAKE) test
cd contrib/functions/go && $(MAKE) test

e2e-test: ## Run all e2e tests
cd tests/e2etest && go test -v -run TestE2E ./...
Expand All @@ -45,19 +43,14 @@ tidy:
.PHONY: build
build: ## Build all function images.
cd functions/go && $(MAKE) build
cd contrib/functions/go && $(MAKE) build

.PHONY: format
format: ## Run go fix, vet, fmt, lint and generate docs for all functions
cd functions/go && $(MAKE) format
cd contrib/functions/go && $(MAKE) format

push-curated: ## Push images to registry. WARN: This operation should only be done in CI environment.
push: ## Push images to registry. WARN: This operation should only be done in CI environment.
cd functions/go && $(MAKE) push

push-contrib: ## Push images to registry. WARN: This operation should only be done in CI environment.
cd contrib/functions/go && $(MAKE) push

validate-metadata: ## Validate all metadata.yaml files against the schema
cd scripts/generate_docs && go run . validate

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading