Skip to content

Commit

Permalink
Merge branch 'master' into steve/unit-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sklarsa committed Apr 14, 2023
2 parents e9f1f0c + b17a13e commit d60ebab
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 67 deletions.
20 changes: 1 addition & 19 deletions .github/workflows/apidiff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,11 @@ on:
pull_request:

jobs:
check_docs_only:
name: check_docs_only
runs-on: ubuntu-18.04
outputs:
skip: ${{ steps.check_docs_only.outputs.skip }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: check_docs_only
# Since PR's are squashed prior to merging to the branch checked out (default branch),
# HEAD^ will resolve to the previous point in history.
run: |
REF="HEAD^"
[[ -z "${{ github.base_ref }}" ]] || REF=$(git show-ref ${{ github.base_ref }} | head -1 | cut -d' ' -f2)
echo "skip=$(test/check-docs-only.sh $REF)" >> $GITHUB_OUTPUT
go-apidiff:
name: Verify API differences
runs-on: ubuntu-latest
needs: check_docs_only
# Pull requests from different repository only trigger this checks
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) && needs.check_docs_only.outputs.skip != 'true'
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository)
steps:
- name: Clone the code
uses: actions/checkout@v3
Expand Down
20 changes: 1 addition & 19 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,11 @@ on:
pull_request:

jobs:
check_docs_only:
name: check_docs_only
runs-on: ubuntu-18.04
outputs:
skip: ${{ steps.check_docs_only.outputs.skip }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: check_docs_only
# Since PR's are squashed prior to merging to the branch checked out (default branch),
# HEAD^ will resolve to the previous point in history.
run: |
REF="HEAD^"
[[ -z "${{ github.base_ref }}" ]] || REF=$(git show-ref ${{ github.base_ref }} | head -1 | cut -d' ' -f2)
echo "skip=$(test/check-docs-only.sh $REF)" >> $GITHUB_OUTPUT
lint:
name: golangci-lint
runs-on: ubuntu-latest
needs: check_docs_only
# Pull requests from the same repository won't trigger this checks as they were already triggered by the push
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && needs.check_docs_only.outputs.skip != 'true'
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
steps:
- name: Setup Go
uses: actions/setup-go@v4
Expand Down
23 changes: 2 additions & 21 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,6 @@ on:
pull_request:

jobs:
check_docs_only:
name: check_docs_only
runs-on: ubuntu-18.04
outputs:
skip: ${{ steps.check_docs_only.outputs.skip }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: check_docs_only
# Since PR's are squashed prior to merging to the branch checked out (default branch),
# HEAD^ will resolve to the previous point in history.
run: |
REF="HEAD^"
[[ -z "${{ github.base_ref }}" ]] || REF=$(git show-ref ${{ github.base_ref }} | head -1 | cut -d' ' -f2)
echo "skip=$(test/check-docs-only.sh $REF)" >> $GITHUB_OUTPUT
test:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand All @@ -31,9 +14,8 @@ jobs:
os:
- ubuntu-latest
- macos-latest
needs: check_docs_only
# Pull requests from the same repository won't trigger this checks as they were already triggered by the push
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && needs.check_docs_only.outputs.skip != 'true'
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
steps:
- name: Clone the code
uses: actions/checkout@v3
Expand Down Expand Up @@ -61,10 +43,9 @@ jobs:
name: Code coverage
needs:
- test
- check_docs_only
runs-on: ubuntu-latest
# Pull requests from the same repository won't trigger this checks as they were already triggered by the push
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && needs.check_docs_only.outputs.skip != 'true'
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
steps:
- name: Clone the code
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion docs/book/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title = "The Kubebuilder Book"
[output.html]
google-analytics = "UA-119864590-1"
curly-quotes = true
additional-css = ["theme/css/markers.css", "theme/css/custom.css"]
additional-css = ["theme/css/markers.css", "theme/css/custom.css", "theme/css/version-dropdown.css"]
git-repository-url = "https://github.com/kubernetes-sigs/kubebuilder"
edit-url-template = "https://github.com/kubernetes-sigs/kubebuilder/edit/master/docs/book/{path}"

Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/component-config-tutorial/config-type.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Then, run `make build` to implement the interface for your API type, which would
<h1>Use --controller=false</h1>

You may notice this command from the `CronJob` tutorial although here we
explicity setting `--controller=false` because `ProjectConfig` is not
explicitly setting `--controller=false` because `ProjectConfig` is not
intended to be an API extension and cannot be reconciled.

</aside>
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/component-config-tutorial/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ community has been migrating the core components away from this and toward
using versioned config files, referred to as "component configs".

The rest of this tutorial will show you how to configure your kubebuilder
project with the a component config type then moves on to implementing a custom
project with the component config type then moves on to implementing a custom
type so that you can extend this capability.


Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/migration/v3vsv4.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Projects scaffolded with Kubebuilder v3 release still using the `go.kubebuilder.
<aside class="note warning">
<h1>Project customizations</h1>

After using the CLI to create your project, you are free to customise how you see fit. Bear in mind, that it is not recommended to deviate from the proposed layout unless you know what you are doing.
After using the CLI to create your project, you are free to customize how you see fit. Bear in mind, that it is not recommended to deviate from the proposed layout unless you know what you are doing.

For example, you should refrain from moving the scaffolded files, doing so will make it difficult in upgrading your project in the future. You may also lose the ability to use some of the CLI features and helpers. For further information on the project layout, see the doc [What's in a basic project?][basic-project-doc]

Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/plugins/kustomize-v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ If you are looking to scaffold the kustomize configuration manifests for your ow

If you are looking to define that your language plugin should use kustomize use the [Bundle Plugin][bundle]
to specify that your language plugin is a composition with your plugin responsible for scaffold
all that is laguage specific and kustomize for its configuration, see:
all that is language specific and kustomize for its configuration, see:

```go
// Bundle plugin which built the golang projects scaffold by Kubebuilder go/v3
Expand Down
6 changes: 3 additions & 3 deletions docs/book/src/plugins/testing-plugins.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Test Your Plugins

You can test your plugin in two dimenstion:
You can test your plugin in two dimension:

1. Validate your plugin behavior through E2E tests
2. Generate sample projects based on your plugin that can be placed in `./testdata/`
Expand All @@ -18,7 +18,7 @@ You can check [Kubebuilder/v3/test/e2e/utils](https://pkg.go.dev/sigs.k8s.io/kub
Once defined, you can use `TestContext` to:

1. Setup testing environment, e.g:
- Cleanup environment, create temp dir. See [Prepare](https://github.com/kubernetes-sigs/kubebuilder/blob/v3.7.0/test/e2e/utils/test_context.go#L97)
- Clean up the environment, create temp dir. See [Prepare](https://github.com/kubernetes-sigs/kubebuilder/blob/v3.7.0/test/e2e/utils/test_context.go#L97)
- Install prerequisites CRDs: See [InstallCertManager](https://github.com/kubernetes-sigs/kubebuilder/blob/v3.7.0/test/e2e/utils/test_context.go#L138), [InstallPrometheusManager](https://github.com/kubernetes-sigs/kubebuilder/blob/v3.6.0/test/e2e/utils/test_context.go#L171)
2. Validate the plugin behavior, e.g:
- Trigger the plugin's bound subcommands. See [Init](https://github.com/kubernetes-sigs/kubebuilder/blob/v3.7.0/test/e2e/utils/test_context.go#L213), [CreateAPI](https://github.com/kubernetes-sigs/kubebuilder/blob/v3.6.0/test/e2e/utils/test_context.go#L222)
Expand All @@ -39,7 +39,7 @@ It can be straightforward to view content of sample projects generated by your p

For example, Kubebuilder generate [sample projects](https://github.com/kubernetes-sigs/kubebuilder/tree/v3.7.0/testdata) based on different plugins to validate the layouts.

Simiply, you can also use `TextContext` to generate folders of scaffolded projects from your plugin.
Simply, you can also use `TextContext` to generate folders of scaffolded projects from your plugin.
The commands are very similar as mentioned in [creating-plugins](creating-plugins.md#write-e2e-tests).

Following is a general workflow to create a sample by the plugin `go/v3`: (`kbc` is an instance of `TextContext`)
Expand Down
23 changes: 23 additions & 0 deletions docs/book/theme/css/version-dropdown.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.version-dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 90px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 1;
}

.version-dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}

.version-dropdown-content a:hover {
background-color: #f1f1f1;
}

.version-dropdown:hover .version-dropdown-content {
display: block;
}
11 changes: 11 additions & 0 deletions docs/book/theme/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,17 @@
<i class="fa fa-search"></i>
</button>
{{/if}}
<!-- custom code for adding release version dropdown menu -->
<div class="version-dropdown">
<button id="release-version" class="icon-button" type="button" title="Release version" aria-label="Release version" aria-haspopup="true" aria-expanded="false" aria-controls="release-versions">
<i class="fa fa-book"></i>
</button>
<div class="version-dropdown-content">
<a href="https://book.kubebuilder.io/"target="_blank" rel="noopener noreferrer">v3-book</a>
<a href="https://book-v2.book.kubebuilder.io/"target="_blank" rel="noopener noreferrer">v2-book</a>
<a href="https://book-v1.book.kubebuilder.io/"target="_blank" rel="noopener noreferrer">v1-book</a>
</div>
</div>
</div>

<h1 class="menu-title"><img alt="{{ book_title }}" src="{{ path_to_root }}/logos/logo-single-line.png"></h1>
Expand Down

0 comments on commit d60ebab

Please sign in to comment.