Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reimplement shell scripts in typescript #89

Open
wants to merge 1 commit into
base: concierge
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
lib/
dist/
node_modules/
coverage/
26 changes: 0 additions & 26 deletions .github/actions/with-post-steps/action.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/actions/with-post-steps/main.js

This file was deleted.

1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22.11.0
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dist/
node_modules/
coverage/
**/*.yaml
**/*.md
**/*.yml
**/*.json
17 changes: 17 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": false,
"singleQuote": true,
"quoteProps": "as-needed",
"jsxSingleQuote": false,
"trailingComma": "none",
"bracketSpacing": true,
"bracketSameLine": true,
"arrowParens": "avoid",
"proseWrap": "always",
"htmlWhitespaceSensitivity": "css",
"endOfLine": "lf"
}

1 change: 1 addition & 0 deletions .wokeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/*
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This GitHub Action is open source ([Apache License 2.0](./LICENSE)) and we
actively seek any community contributions for code, suggestions and
documentation. This page details a few notes, workflows and suggestions for
documentation. This page details a few notes, workflows and suggestions for
how to make contributions most effective and help us all build a better workflow -
please give them a read before working on any contributions.

Expand All @@ -12,8 +12,8 @@ This action has been created under the [Apache License 2.0](./LICENSE), which
will cover any contributions you may make to this project. Please familiarise
yourself with the terms of the license.

Additionally, this charm uses the Harmony CLA agreement. It’s the easiest way
for you to give us permission to use your contributions. In effect, you’re
Additionally, this charm uses the Harmony CLA agreement. It’s the easiest way
for you to give us permission to use your contributions. In effect, you’re
giving us a license, but you still own the copyright — so you retain the right
to modify your code and use it in other projects. Please [sign the CLA
here](https://ubuntu.com/legal/contributors/agreement) before making any
Expand All @@ -31,5 +31,5 @@ Building using npm:
```
sudo snap install node --channel 20/stable # installs npm
npm install # install / update dependencies
NODE_OPTIONS=--openssl-legacy-provider npm run build # Run the build
npm run bundle # Bundle the typescript
```
84 changes: 44 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ Simply include the action as a step in your Workflow:

This will give your job an environment with the following:

* Tox installed
* Juju installed
* A LXD (default) controller bootstrapped
- Tox installed
- Juju installed
- A LXD (default) controller bootstrapped

In addition to LXD, the action also supports Microk8s out-of-the-box. You can
also use any other provider by passing in a `credentials.yaml` file (for public
Expand Down Expand Up @@ -56,21 +56,24 @@ jobs:
clouds-yaml: ${{ secrets.CLOUDS_YAML }}
bootstrap-options: "--model-default datastore=my-datastore"
```

## microk8s provider

Using the microk8s provider some default add-ons will be enabled - specifically
dns, storage and rbac. You can override these defaults with the following:

```yaml
add-on-test:
runs-on: ubuntu-latest
name: Testing custom addons
steps:
- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@main
with:
provider: microk8s
microk8s-addons: "storage dns rbac registry"
add-on-test:
runs-on: ubuntu-latest
name: Testing custom addons
steps:
- name: Setup operator environment
uses: charmed-kubernetes/actions-operator@main
with:
provider: microk8s
microk8s-addons: "storage dns rbac registry"
```

Currently, if specific addons are defined, a minimum set of addons (the defaults) `dns, storage, rbac` must be enabled for the action to work properly..

## pytest-operator
Expand All @@ -80,6 +83,7 @@ manage models, interacting with juju, charm building, bundle parameterization,
and other features for testing Operator Charms.

## Multiple controllers

You can bootstrap multiple controllers. Each controller will be named after
the provider used to bootstrap it (e.g. `github-pr-ad8d9-microk8s`). This means
that you can currently bootstrap only one controller of each kind.
Expand All @@ -92,34 +96,34 @@ Note: there is a [known issue](https://bugs.launchpad.net/juju/+bug/2003582)
deploying lxd next to microk8s on Juju 2.9 (this works with Juju 3).

```yaml
multi-controller-tests:
name: microk8s-and-lxd-test
runs-on: ubuntu-latest
steps:
- name: Setup k8s controller
uses: charmed-kubernetes/actions-operator@main
with:
juju-channel: 3.0/stable
provider: microk8s
channel: 1.26-strict/stable
- name: Save k8s controller name
id: k8s-controller
# The `CONTROLLER_NAME` envvar is set by this actions
run: echo "name=$CONTROLLER_NAME" >> $GITHUB_OUTPUT
- name: Setup lxd controller
uses: charmed-kubernetes/actions-operator@main
with:
juju-channel: 3.0/stable
provider: lxd
- name: Save lxd controller name
id: lxd-controller
# The `CONTROLLER_NAME` envvar is set by this action
run: echo "name=$CONTROLLER_NAME" >> $GITHUB_OUTPUT
- name: Run integration tests
run: ...
env:
K8S_CONTROLLER: ${{ steps.k8s-controller.outputs.name }}
LXD_CONTROLLER: ${{ steps.lxd-controller.outputs.name }}
multi-controller-tests:
name: microk8s-and-lxd-test
runs-on: ubuntu-latest
steps:
- name: Setup k8s controller
uses: charmed-kubernetes/actions-operator@main
with:
juju-channel: 3.0/stable
provider: microk8s
channel: 1.26-strict/stable
- name: Save k8s controller name
id: k8s-controller
# The `CONTROLLER_NAME` envvar is set by this actions
run: echo "name=$CONTROLLER_NAME" >> $GITHUB_OUTPUT
- name: Setup lxd controller
uses: charmed-kubernetes/actions-operator@main
with:
juju-channel: 3.0/stable
provider: lxd
- name: Save lxd controller name
id: lxd-controller
# The `CONTROLLER_NAME` envvar is set by this action
run: echo "name=$CONTROLLER_NAME" >> $GITHUB_OUTPUT
- name: Run integration tests
run: ...
env:
K8S_CONTROLLER: ${{ steps.k8s-controller.outputs.name }}
LXD_CONTROLLER: ${{ steps.lxd-controller.outputs.name }}
```

[pytest-operator]: https://github.com/charmed-kubernetes/pytest-operator
16 changes: 6 additions & 10 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "Setup Operator environment"
description: "Setup a operator environment"
author: "Adam Stokes"
author: "Adam Dyess"
inputs:
concierge-channel:
description: |
Expand Down Expand Up @@ -80,14 +80,10 @@ inputs:
container-registry-url:
description: "Container registry to use"
runs:
using: "composite"
steps:
- name: Cache
uses: ./.github/actions/with-post-steps
with:
json: ${{ toJson(inputs) }}
main: "src/bootstrap/main.sh"
post: "src/cleanup/main.sh"
using: node20
main: ./dist/bootstrap/index.js
post: ./dist/cleanup/index.js

branding:
icon: "play"
icon: "cloud"
color: "blue"
Loading
Loading