Skip to content

Commit

Permalink
Remove array util refs - Migrate to reusable release workflow - Add s…
Browse files Browse the repository at this point in the history
…hell shims
  • Loading branch information
jordojordo committed Oct 9, 2024
1 parent c8f69bf commit cec4f6c
Show file tree
Hide file tree
Showing 13 changed files with 219 additions and 160 deletions.
2 changes: 0 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ module.exports = {
extends: [
'standard',
'eslint:recommended',
'@nuxtjs/eslint-config-typescript',
'plugin:cypress/recommended'
],
// add your custom rules here
rules: {
'dot-notation': 'off',
'generator-star-spacing': 'off',
Expand Down
113 changes: 5 additions & 108 deletions .github/workflows/build-extension-charts.yml
Original file line number Diff line number Diff line change
@@ -1,125 +1,22 @@
name: Build and Release Extension Charts

on:
workflow_dispatch:
release:
types: [released]

env:
ACTIONS_RUNNER_DEBUG: false
CI_COMMIT_MESSAGE: CI Build Artifacts
TARGET_BRANCH: gh-pages

defaults:
run:
shell: bash
working-directory: ./

jobs:
build-extension-artifact:
name: Build extension artifact
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Setup Helm
uses: azure/setup-helm@v4
with:
version: v3.14.4

- name: Setup Nodejs and npm
uses: actions/setup-node@v4
with:
node-version: '16'

- name: Setup yarn
run: npm install -g yarn

- name: Setup Nodejs with yarn caching
uses: actions/setup-node@v4
with:
node-version: '16'
cache: yarn

- name: Install dependencies
run: yarn

- name: Parse Extension Name
if: github.ref_type == 'tag'
id: parsed-name
env:
GH_TOKEN: ${{ github.token }}
run: |
chmod +x ./node_modules/@rancher/shell/scripts/extension/parse-tag-name
yarn parse-tag-name ${{ github.ref_name }} ${{ github.run_id }} "charts"
- name: Run build script
shell: bash
id: build_script
run: |
publish="yarn publish-pkgs -s ${{ github.repository }} -b ${{ env.TARGET_BRANCH }}"
if [[ -n "${{ github.ref_name }}" ]]; then
publish="$publish -t ${{ github.ref_name }}"
fi
$publish
- name: Upload charts artifact
if: github.ref_type == 'tag' || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request')
uses: actions/upload-artifact@v4
with:
name: charts
path: tmp

release:
name: Release Build
if: github.ref_type == 'tag' || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request')
needs: build-extension-artifact
runs-on: ubuntu-latest
build-extension-charts:
uses: rancher/dashboard/.github/workflows/build-extension-charts.yml@master
permissions:
actions: write
contents: write
deployments: write
pages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: "${{ env.TARGET_BRANCH }}"

- name: Configure Git
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: charts

- name: Commit build
run: |
git add ./{assets,charts,extensions,index.yaml}
git commit -a -m "${{ env.CI_COMMIT_MESSAGE }}"
git push
- name: Run chart-releaser
uses: helm/[email protected]
with:
charts_dir: ./charts/*
env:
CR_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
CR_SKIP_EXISTING: true

with:
target_branch: gh-pages
tagged_release: ${{ github.ref_name }}
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ jobs:
- name: Setup Nodejs and npm
uses: actions/setup-node@v4
with:
node-version: '16'
node-version: '20'

- name: Setup yarn
run: npm install -g yarn

- name: Setup Nodejs with yarn caching
uses: actions/setup-node@v4
with:
node-version: '16'
node-version: '20'
cache: yarn

- name: Install dependencies
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dependencies": {
"@kubernetes/client-node": "^0.20.0",
"@rancher/components": "^0.3.0-alpha.1",
"@rancher/shell": "^3.0.0-rc.4",
"@rancher/shell": "3.0.0-rc.5",
"cache-loader": "^4.1.0",
"color": "4.2.3",
"core-js": "^3.37.1",
Expand All @@ -36,11 +36,13 @@
"@vue/cli-plugin-unit-jest": "^5.0.8",
"@vue/vue2-jest": "^29.2.6",
"babel-jest": "^29.7.0",
"file-loader": "^6.2.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"sass-loader": "10.1.1",
"ts-jest": "^29.1.5",
"typescript": "4.5.5"
"typescript": "4.5.5",
"url-loader": "^4.1.1"
},
"engines": {
"node": ">=20"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script>
import { _CREATE, _VIEW } from '@shell/config/query-params';
import { removeAt } from '@shell/utils/array';
import { isEmpty } from '@shell/utils/object';
import { Banner } from '@components/Banner';
Expand Down Expand Up @@ -81,7 +80,7 @@ export default {
},
removeResource(index) {
removeAt(this.contextAwareResources, index);
this.contextAwareResources.splice(index, 1);
}
}
};
Expand Down
3 changes: 1 addition & 2 deletions pkg/kubewarden/chart/kubewarden/admission/Rules/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script>
import { _CREATE, _VIEW } from '@shell/config/query-params';
import { SCHEMA } from '@shell/config/types';
import { removeAt } from '@shell/utils/array';
import Loading from '@shell/components/Loading';
Expand Down Expand Up @@ -85,7 +84,7 @@ export default {
},
removeRule(index) {
removeAt(this.rules, index);
this.rules.splice(index, 1);
}
}
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script>
import { _EDIT, _VIEW } from '@shell/config/query-params';
import { removeAt } from '@shell/utils/array';
import FileSelector, { createOnSelected } from '@shell/components/form/FileSelector';
import { LabeledInput } from '@components/Form/LabeledInput';
Expand Down Expand Up @@ -52,7 +51,7 @@ export default {
},
removeCert(cIndex) {
removeAt(this.chartValues.certs, cIndex);
this.chartValues.certs.splice(cIndex, 1);
},
update() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script>
import { _VIEW } from '@shell/config/query-params';
import { removeAt } from '@shell/utils/array';
import { isEmpty } from '@shell/utils/object';
import Authority from './Authority';
Expand Down Expand Up @@ -63,7 +62,7 @@ export default {
},
removeRegistry(index) {
removeAt(this.rows, index);
this.rows.splice(index, 1);
this.deleteAuthority(index);
},
Expand Down
3 changes: 1 addition & 2 deletions pkg/kubewarden/plugins/kubewarden-class.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import SteveModel from '@shell/plugins/steve/steve-class';
import { STATES, STATES_ENUM } from '@shell/plugins/dashboard-store/resource-class';
import { MANAGEMENT, SERVICE } from '@shell/config/types';
import { SHOW_PRE_RELEASE } from '@shell/store/prefs';
import { isArray } from '@shell/utils/array';
import { addParams } from '@shell/utils/url';

import {
Expand Down Expand Up @@ -159,7 +158,7 @@ export default class KubewardenModel extends SteveModel {
let traceArray = [];

// If a policy is in monitor mode it will pass multiple trace objects
if (isArray(traces)) {
if (Array.isArray(traces)) {
traceArray = [
...new Map(traces.map(trace => [trace['traceID'], trace])).values(),
];
Expand Down
Loading

0 comments on commit cec4f6c

Please sign in to comment.