Skip to content

Commit

Permalink
Feature/resolve vulnerability issues (#35)
Browse files Browse the repository at this point in the history
* Update SDK to solve vulnerability issues

Like deprecation of request package

Solves:
#30
#23
#21
Signed-off-by: Yonatan Kiron <yonatan.kiron@coralogix.com>

* Change api endpoint to ingress as api is legacy

Signed-off-by: Yonatan Kiron <yonatan.kiron@coralogix.com>

* Add github action

Signed-off-by: Yonatan Kiron <yonatan.kiron@coralogix.com>

* Add proxy test example

Signed-off-by: Yonatan Kiron <yonatan.kiron@coralogix.com>

* Dist commit

Signed-off-by: Yonatan Kiron <yonatan.kiron@coralogix.com>

* Remove privateKey annotations

Signed-off-by: Yonatan Kiron <yonatan.kiron@coralogix.com>

---------

Signed-off-by: Yonatan Kiron <yonatan.kiron@coralogix.com>
  • Loading branch information
YonatanKiron authored Jan 2, 2024
1 parent 15cca62 commit 2e4eb74
Show file tree
Hide file tree
Showing 42 changed files with 753 additions and 334 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
on:
push:
branches:
- master

name: Bump Version

# Avoid race conditions with tags release
concurrency: nodejs-coralogix-sdk

jobs:
# CI is performed by ArgoCD
push-tag:
name: Push new tag
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate-token
uses: tibdex/github-app-token@v1
with:
github_api_url: https://api.github.com
app_id: ${{ secrets.AUTOMATION_APP_ID }}
private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
- name: Checkout sources
uses: actions/checkout@v2
with:
# Required so the tags can be detected
fetch-depth: 0
github_token: ${{ steps.generate-token.outputs.token }}
- name: Configure committer
run: |
git config --local user.email "121110262+coralogix-automation[bot]@users.noreply.github.com"
git config --local user.name "coralogix-automation[bot]"
git remote set-url origin https://coralogix-automation:${{ steps.generate-token.outputs.token }}@github.com/coralogix/nodejs-coralogix-sdk
- name: Bump version
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
npm install -g standard-version
git checkout -b chore/${{ github.run_number }}
standard-version --skip.tag
npm run update-version
git add .
git commit -m "Created SDK version file"
git push --follow-tags origin chore/${{ github.run_number }}
gh pr create --base master --head chore/${{ github.run_number }} --fill
gh api -XPOST /repos/coralogix/nodejs-coralogix-sdk/statuses/$(git rev-parse HEAD) -f state=success -f context="ticket-id-validator"
gh api -XPOST /repos/coralogix/nodejs-coralogix-sdk/statuses/$(git rev-parse HEAD) -f state=success -f context="All Status Checks"
gh pr merge --delete-branch --admin --squash chore/${{ github.run_number }}
git checkout master
git pull
git tag v$(npm pkg get version | sed 's/"//g')
git push --tags
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: Node.js Package

on:
release:
types: [created]
#change to this when you need to publish on pr level
#on:
# push:
# branches:
# - your-branch-name

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Publish to npm
working-directory: dist/libs/browser
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/npm-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Node.js Test

#change to this when you need to publish on pr level
on:
pull_request:
paths:
- '**.js'
- '**.ts'
- .github/workflows/npm-test.yml

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
#- uses: webfactory/ssh-agent@v0.8.0
# with:
# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Install dependencies
run: npm install
- name: Run tests
run: npm run test
2 changes: 1 addition & 1 deletion dist/constants.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export declare class Constants {
* @description Coralogix logs API endpoint (production)
* @static
* @public
* @default https://api.coralogix.com:443/api/v1/logs
* @default https://ingress.coralogix.com:443/api/v1/logs
*/
static PROD_URL: string;
/**
Expand Down
Loading

0 comments on commit 2e4eb74

Please sign in to comment.