Skip to content

Commit

Permalink
feat: update to conform with fbl@1.15.0 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad-tkachenko committed Jan 22, 2021
1 parent 114d00c commit 1d8696c
Show file tree
Hide file tree
Showing 15 changed files with 1,032 additions and 3,273 deletions.
140 changes: 0 additions & 140 deletions .circleci/config.yml

This file was deleted.

47 changes: 47 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Public NPM Package

on:
release:
types: [created]

jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14.x'

- run: yarn install
- run: yarn docker:test

# send test coverage
- run: bash <(curl -s https://codecov.io/bash) -f ./coverage/coverage.lcov

- uses: actions/upload-artifact@v2
with:
name: coverage
path: ./coverage/

- uses: actions/upload-artifact@v2
with:
name: mochawesome-report
path: ./mochawesome-report/

build_and_publish:
needs: [build_and_test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
- run: yarn install
- run: yarn build
- run: yarn install --prod

- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Tests

on:
push:
branches:
- develop

jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '14.x'

- run: yarn install
- run: yarn docker:test

# send test coverage
- run: bash <(curl -s https://codecov.io/bash) -f ./coverage/coverage.lcov

- uses: actions/upload-artifact@v2
with:
name: coverage
path: ./coverage/

- uses: actions/upload-artifact@v2
with:
name: mochawesome-report
path: ./mochawesome-report/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Install, Update, Delete helm chart releases with ease in your [fbl](https://fbl.fireblink.com) flows.

[![CircleCI](https://circleci.com/gh/FireBlinkLTD/fbl-plugins-k8s-helm.svg?style=svg)](https://circleci.com/gh/FireBlinkLTD/fbl-plugins-k8s-helm)
[![Tests](https://github.com/FireBlinkLTD/fbl-plugins-k8s-helm/workflows/Tests/badge.svg)](https://github.com/FireBlinkLTD/fbl-plugins-k8s-helm/actions?query=workflow%3ATests)
[![Known Vulnerabilities](https://snyk.io/test/github/FireBlinkLTD/fbl-plugins-k8s-helm/badge.svg)](https://snyk.io/test/github/FireBlinkLTD/fbl-plugins-k8s-helm)
[![codecov](https://codecov.io/gh/FireBlinkLTD/fbl-plugins-k8s-helm/branch/master/graph/badge.svg)](https://codecov.io/gh/FireBlinkLTD/fbl-plugins-k8s-helm)
[![Total alerts](https://img.shields.io/lgtm/alerts/g/FireBlinkLTD/fbl-plugins-k8s-helm.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/FireBlinkLTD/fbl-plugins-k8s-helm/alerts/)
Expand Down
44 changes: 21 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fbl-plugins/k8s-helm",
"version": "1.2.0",
"version": "1.3.0",
"description": "FBL plugin for K8s Helm CLI",
"main": "dist/index.js",
"scripts": {
Expand All @@ -15,48 +15,46 @@
"docker:test": "rimraf coverage/ && rimraf .nyc_output/ && rimraf mochawesome-report/ && docker-compose up --build --abort-on-container-exit",
"build": "rimraf ./dist/ && tsc",
"lint": "tslint -c tslint.json src/**/*.ts test/**/*.ts index.ts",
"prettify": "prettier src/**/*.{md,ts,json} test/**/*.{md,ts,json} index.{md,ts,json} --write --config .prettierrc.yml && tslint 'src/**/*.ts' 'test/**/*.ts' 'index.ts' --fix",
"prepublishOnly": "npm run build && npm run lint"
"prettify": "prettier src/**/*.{md,ts,json} test/**/*.{md,ts,json} index.{md,ts,json} --write --config .prettierrc.yml && tslint 'src/**/*.ts' 'test/**/*.ts' 'index.ts' --fix"
},
"author": "FireBlink LTD",
"license": "MIT",
"dependencies": {
"joi": "17.2.1",
"js-yaml": "3.14.0",
"typedi": "0.8.0"
"joi": "17.3.0",
"js-yaml": "4.0.0"
},
"peerDependencies": {
"fbl": ">=1.14.0 <2.0.0"
"fbl": ">=1.15.0 <2.0.0"
},
"devDependencies": {
"@commitlint/cli": "9.1.2",
"@commitlint/config-conventional": "9.1.2",
"@commitlint/cli": "11.0.0",
"@commitlint/config-conventional": "11.0.0",
"@fireblink/k8s-api-client": "1.2.0",
"@types/chai": "4.2.12",
"@types/chai": "4.2.14",
"@types/form-data": "2.5.0",
"@types/joi": "14.3.4",
"@types/js-yaml": "3.12.5",
"@types/node": "14.6.3",
"@types/joi": "17.2.3",
"@types/js-yaml": "4.0.0",
"@types/node": "14.14.22",
"chai": "4.2.0",
"chai-as-promised": "7.1.1",
"commitizen": "4.2.1",
"conventional-changelog-cli": "2.1.0",
"commitizen": "4.2.3",
"conventional-changelog-cli": "2.1.1",
"cz-conventional-changelog": "3.3.0",
"fbl": "1.14.0",
"husky": "4.2.5",
"fbl": "1.15.0",
"husky": "4.3.8",
"jsonlint": "1.6.3",
"lint-staged": "10.3.0",
"mocha": "8.1.3",
"lint-staged": "10.5.3",
"mocha": "8.2.1",
"mocha-typescript": "1.1.17",
"mochawesome": "6.1.1",
"mochawesome": "6.2.1",
"nyc": "15.1.0",
"prettier": "2.1.1",
"prettier": "2.2.1",
"rimraf": "3.0.2",
"source-map-support": "0.5.19",
"ts-node": "9.0.0",
"ts-node": "9.1.1",
"tslint": "6.1.3",
"tslint-config-prettier": "1.18.0",
"typescript": "4.0.2",
"typescript": "4.1.3",
"yarn-check": "0.0.3"
},
"nyc": {
Expand Down
3 changes: 1 addition & 2 deletions src/processors/BaseActionProcessor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ActionProcessor, ChildProcessService, FSUtil } from 'fbl';
import Container from 'typedi';

export abstract class BaseActionProcessor extends ActionProcessor {
/**
Expand All @@ -19,7 +18,7 @@ export abstract class BaseActionProcessor extends ActionProcessor {
stderr: string;
}> {
binary = binary || 'helm';
const childProcessService = Container.get(ChildProcessService);
const childProcessService = ChildProcessService.instance;

const stdout: string[] = [];
const stderr: string[] = [];
Expand Down
9 changes: 4 additions & 5 deletions src/processors/UpgradeOrInstallActionProcessor.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { FSUtil, TempPathsRegistry, FlowService, ContextUtil } from 'fbl';
import * as Joi from 'joi';
import Container from 'typedi';
import { promisify } from 'util';
import { writeFile, exists } from 'fs';
import { dump, safeLoad } from 'js-yaml';
import { dump, load } from 'js-yaml';

import { BaseActionProcessor } from './BaseActionProcessor';

Expand Down Expand Up @@ -82,8 +81,8 @@ export class UpgradeOrInstallActionProcessor extends BaseActionProcessor {
* Prepare CLI args
*/
private async prepareCLIArgs(): Promise<string[]> {
const tempPathsRegistry = Container.get(TempPathsRegistry);
const flowService = Container.get(FlowService);
const tempPathsRegistry = TempPathsRegistry.instance;
const flowService = FlowService.instance;

const args: string[] = ['upgrade', '--install'];

Expand Down Expand Up @@ -116,7 +115,7 @@ export class UpgradeOrInstallActionProcessor extends BaseActionProcessor {
this.parameters,
);

let fileContentObject = safeLoad(fileContent);
let fileContentObject = load(fileContent);

// resolve local template
fileContentObject = await flowService.resolveOptionsWithNoHandlerCheck(
Expand Down
9 changes: 4 additions & 5 deletions src/processors/UpgradeOrInstallV2ActionProcessor.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { FSUtil, TempPathsRegistry, FlowService, ContextUtil } from 'fbl';
import * as Joi from 'joi';
import Container from 'typedi';
import { promisify } from 'util';
import { writeFile, exists } from 'fs';
import { dump, safeLoad } from 'js-yaml';
import { dump, load } from 'js-yaml';

import { BaseActionProcessor } from './BaseActionProcessor';

Expand Down Expand Up @@ -82,8 +81,8 @@ export class UpgradeOrInstallV2ActionProcessor extends BaseActionProcessor {
* Prepare CLI args
*/
private async prepareCLIArgs(): Promise<string[]> {
const tempPathsRegistry = Container.get(TempPathsRegistry);
const flowService = Container.get(FlowService);
const tempPathsRegistry = TempPathsRegistry.instance;
const flowService = FlowService.instance;

const args: string[] = ['upgrade', '--install'];

Expand Down Expand Up @@ -116,7 +115,7 @@ export class UpgradeOrInstallV2ActionProcessor extends BaseActionProcessor {
this.parameters,
);

let fileContentObject = safeLoad(fileContent);
let fileContentObject = load(fileContent);

// resolve local template
fileContentObject = await flowService.resolveOptionsWithNoHandlerCheck(
Expand Down
2 changes: 1 addition & 1 deletion test/assets/k8s-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ else
fi

echo "-> installing tiller..."
helm_v2 init --wait --force-upgrade
helm_v2 init --stable-repo-url=https://charts.helm.sh/stable --wait --force-upgrade
kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
Expand Down
Loading

0 comments on commit 1d8696c

Please sign in to comment.