diff --git a/.github/workflows/njsscan.yaml b/.github/workflows/njsscan.yaml deleted file mode 100644 index f5af2a9..0000000 --- a/.github/workflows/njsscan.yaml +++ /dev/null @@ -1,56 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -# This workflow integrates njsscan with GitHub's Code Scanning feature -# nodejsscan is a static security code scanner that finds insecure code patterns in your Node.js applications - -name: njsscan sarif - -on: - push: - branches: ['main'] - pull_request: - # The branches below must be a subset of the branches above - branches: ['main'] - schedule: - - cron: '37 21 * * 1' - -permissions: - contents: read - -jobs: - njsscan: - permissions: - contents: read # for actions/checkout to fetch code - security-events: write # for github/codeql-action/upload-sarif to upload SARIF results - actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status - runs-on: ubuntu-latest - name: njsscan code scanning - steps: - - name: Checkout the code - uses: actions/checkout@v3 - - name: nodejsscan scan - id: njsscan - uses: ajinabraham/njsscan-action@7237412fdd36af517e2745077cedbf9d6900d711 - with: - args: '. --sarif --output results.sarif || true' - - name: Upload njsscan report - uses: github/codeql-action/upload-sarif@v2 - with: - sarif_file: results.sarif - - name: Notify failures - if: failure() - uses: rtCamp/action-slack-notify@v2 - env: - SLACK_LINK_NAMES: true - SLACK_MESSAGE: - # prettier-ignore - "hey @${{ github.actor }}, @mark, sorry to let you know you broke the build" - SLACK_CHANNEL: feed-github - SLACK_COLOR: ${{ job.status }} - SLACK_ICON: https://avatars.githubusercontent.com/u/82425418?s=200&v=4 - SLACK_TITLE: 'Failed: cld-cli to dev :fire:' - SLACK_USERNAME: cld-cli-bot - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/src/commands/aws-cld/bootstrap.ts b/src/commands/aws-cld/bootstrap.ts new file mode 100644 index 0000000..bdf62e9 --- /dev/null +++ b/src/commands/aws-cld/bootstrap.ts @@ -0,0 +1,52 @@ +import { Command, Flags } from '@oclif/core'; +import fs from 'node:fs'; +import { render } from 'template-file'; + +const bootstrapTemplate = `module "bootstrap" { + source = "github.com/markcallen/aws-cld//bootstrap/" + project = "{{ project }}" +} + +output "project" { + value = module.bootstrap.project_name +} +`; + +export default class Bootstrap extends Command { + static description = 'AWS quick utilities'; + + static examples = [ + `$ <%= config.bin %> <%= command.id %> +` + ]; + + static flags = { + directory: Flags.string({ char: 'd', required: true }), + project: Flags.string({ char: 'p', required: true }) + }; + + async run(): Promise { + const { flags } = await this.parse(Bootstrap); + + const { directory, project } = flags; + + if (fs.existsSync(directory)) { + this.error(`${directory} exists`); + } + + fs.mkdirSync(directory); + + // Make the boostrap, infra and env directories + fs.mkdirSync(`${directory}/bootstrap`); + fs.mkdirSync(`${directory}/infra`); + fs.mkdirSync(`${directory}/env`); + + const bootstrapData = { project }; + fs.writeFileSync( + `${directory}/bootstrap/main.tf`, + render(bootstrapTemplate, bootstrapData) + ); + + // TODO: add in terraform init, plan and apply + } +} diff --git a/src/commands/aws-cld/index.ts b/src/commands/aws-cld/index.ts new file mode 100644 index 0000000..37d75e1 --- /dev/null +++ b/src/commands/aws-cld/index.ts @@ -0,0 +1,17 @@ +import { Command } from '@oclif/core'; + +export default class AwsCld extends Command { + static description = 'AWS quick utilities'; + + static examples = [ + `$ <%= config.bin %> <%= command.id %> +aws-cld +` + ]; + + async run(): Promise { + await this.parse(AwsCld); + + this.log('aws-cld'); + } +}