diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2b40b77 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,20 @@ +node_modules/ +.j1-integration/ +dist/ +.env +.eslintcache +.git/ +.github/ +configs/ +docs/ +terraform/ +test/ +CHANGELOG.md +husky.config.js +jest.config.js +lint-staged-config.js +prettier.config.js +.eslintignore +.eslintrc +.gitleaks.yml +.prettierignore diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 62de6ca..2df607b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,73 +2,14 @@ name: Build on: [push, pull_request] jobs: - test: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - node-version: [14.x] - os: [ubuntu-latest] - - steps: - - id: setup-node - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - - name: Check out code repository source code - uses: actions/checkout@v2 - - - name: Install dependencies - run: yarn - - - name: Run tests - run: yarn test:ci - - - name: Run build - run: yarn build - - # Publishing is done in a separate job to allow - # for all matrix builds to complete. - release: - needs: test + publish-image: runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' - strategy: - fail-fast: false - matrix: - node: [14] - steps: - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: 14.x - - - name: Check out repo - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + - id: publish-image + uses: jupiterone/publish-integration-image-action@v1.0.3-beta with: - fetch-depth: 2 - - # Fetch tags and describe the commit before the merge commit - # to see if it's a version publish - - name: Fetch tags - run: | - git fetch --tags - if git describe --exact-match --match "v*.*.*" HEAD^2 - then - echo "Found version commit tag. Publishing." - echo "publish=true" >> $GITHUB_ENV - else - echo "Version commit tag not found. Not publishing." - fi - - - name: Publish - if: env.publish == 'true' - env: - NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} - run: | - echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc - yarn - npm publish + package-name: 'ceelias/graph-salesforce' + docker-username: ${{ secrets.DOCKERHUB_USERNAME }} + docker-password: ${{ secrets.DOCKERHUB_TOKEN }} + push-to-registry: 'true' diff --git a/.github/workflows/gitleaks.yml b/.github/workflows/gitleaks.yml deleted file mode 100644 index c93f387..0000000 --- a/.github/workflows/gitleaks.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: gitleaks - -on: [push, pull_request] - -jobs: - gitleaks: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: gitleaks-action - uses: gitleaks/gitleaks-action@v1.6.0 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0bb3dfe --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM node:14-bullseye-slim + +ARG j1_dev_enabled=false + +ENV JUPITERONE_INTEGRATION_DIR=/opt/jupiterone/integration + +RUN apt-get update +RUN apt-get -y install g++ make python + +COPY package.json yarn.lock LICENSE ${JUPITERONE_INTEGRATION_DIR}/ +COPY src/ ${JUPITERONE_INTEGRATION_DIR}/src +COPY scripts/ ${JUPITERONE_INTEGRATION_DIR}/scripts + +WORKDIR ${JUPITERONE_INTEGRATION_DIR} +RUN yarn install +RUN chmod +x ./scripts/run.sh + +CMD ["yarn", "execute"] diff --git a/package.json b/package.json index fd8d49b..6fcde69 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,8 @@ }, "scripts": { "start": "j1-integration collect", + "execute": "./scripts/run.sh", + "collect": "./scripts/collect.sh", "graph": "j1-integration visualize", "graph:types": "j1-integration visualize-types", "lint": "eslint . --cache --fix --ext .ts,.tsx", diff --git a/scripts/collect.sh b/scripts/collect.sh new file mode 100644 index 0000000..2bad31b --- /dev/null +++ b/scripts/collect.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +JUPITERONE_API_KEY=$JUPITERONE_API_KEY JUPITERONE_ACCOUNT=$JUPITERONE_ACCOUNT_ID yarn j1-integration collect diff --git a/scripts/run.sh b/scripts/run.sh new file mode 100644 index 0000000..adbdd01 --- /dev/null +++ b/scripts/run.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ -z "$JUPITERONE_API_BASE_URL" ] +then + JUPITERONE_API_KEY=$JUPITERONE_API_KEY JUPITERONE_ACCOUNT=$JUPITERONE_ACCOUNT_ID yarn j1-integration run -i $INTEGRATION_INSTANCE_ID +else + JUPITERONE_API_KEY=$JUPITERONE_API_KEY JUPITERONE_ACCOUNT=$JUPITERONE_ACCOUNT_ID yarn j1-integration run -i $INTEGRATION_INSTANCE_ID --api-base-url $JUPITERONE_API_BASE_URL +fi