diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..e7c9735 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,46 @@ +version: 2.1 + +setup: true + +orbs: + orb-tools: circleci/orb-tools@11.1 + shellcheck: circleci/shellcheck@3.1 + +filters: &filters + tags: + only: /.*/ + +workflows: + lint-pack: + jobs: + - orb-tools/lint: + filters: *filters + + - orb-tools/pack: + filters: *filters + + - orb-tools/review: + filters: *filters + + - shellcheck/check: + filters: *filters + + - orb-tools/publish: + orb-name: zygopleural/snaplet + vcs-type: << pipeline.project.type >> + requires: + - orb-tools/lint + - orb-tools/review + - orb-tools/pack + - shellcheck/check + # Use a context to hold your publishing token. + context: orb-publishing + filters: *filters + + # Triggers the next workflow in the Orb Development Kit. + - orb-tools/continue: + pipeline-number: << pipeline.number >> + vcs-type: << pipeline.project.type >> + requires: + - orb-tools/publish + filters: *filters diff --git a/.circleci/test-deploy.yml b/.circleci/test-deploy.yml new file mode 100644 index 0000000..7e25f79 --- /dev/null +++ b/.circleci/test-deploy.yml @@ -0,0 +1,73 @@ +version: 2.1 + +orbs: + snaplet: zygopleural/snaplet@dev:<> + orb-tools: circleci/orb-tools@11.1 + +filters: &filters + tags: + only: /.*/ + +jobs: + restore-test: + working_directory: ~/repo/app + docker: + - image: cimg/base:current + - image: cimg/postgres:14.0 + environment: + POSTGRES_USER: snaplet + POSTGRES_PASSWORD: snaplet + POSTGRES_DB: snaplet + environment: + PGPASSWORD: snaplet + steps: + - checkout: + path: ~/repo + - run: + name: Waiting for Postgres to be ready + command: dockerize -wait tcp://localhost:5432 -timeout 1m + - run: + name: Initial migration + command: psql --host localhost --username snaplet --dbname snaplet --echo-all --file ./migration.sql + - run: + name: Assert empty + command: | + COUNT=$(psql -h localhost -U snaplet -d snaplet -AXqtc "SELECT COUNT(*) FROM cats;") + exit $COUNT + - snaplet/restore + - run: + name: Assert not-empty + command: | + COUNT=$(psql -h localhost -U snaplet -d snaplet -AXqtc "SELECT COUNT(*) FROM cats;") + if [ "${COUNT}" -eq "0" ] + then + exit 1 + else + echo "#cats = ${COUNT}" + exit 0 + fi + +workflows: + test-deploy: + jobs: + # Make sure to include "filters: *filters" in every test job you want to run as part of your deployment. + - restore-test: + filters: *filters + context: snaplet-orb-tests + + - orb-tools/pack: + filters: *filters + + - orb-tools/publish: + orb-name: zygopleural/snaplet + vcs-type: << pipeline.project.type >> + pub-type: production + requires: + - orb-tools/pack + - restore-test + context: orb-publishing + filters: + branches: + ignore: /.*/ + tags: + only: /^v[0-9]+\.[0-9]+\.[0-9]+$/ diff --git a/.github/ISSUE_TEMPLATE/BUG.yml b/.github/ISSUE_TEMPLATE/BUG.yml new file mode 100644 index 0000000..3ee6dd1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BUG.yml @@ -0,0 +1,41 @@ +name: "\U0001F41E Bug Report" +description: Report any identified bugs. +title: 'Bug: ' +labels: [bug] +# assignees: '' +body: + - type: checkboxes + attributes: + label: "Is there an existing issue for this?" + description: "Please search [here](https://github.com/zygopleural/snaplet-circleci-orb/issues?q=is%3Aissue) to see if an issue already exists for the bug you encountered" + options: + - label: "I have searched the existing issues" + required: true + + - type: input + attributes: + label: "Orb version" + description: | + Which version of `zygopleural/snaplet` are you using? + placeholder: "1.0.0" + + - type: textarea + validations: + required: true + attributes: + label: "Current behavior" + description: "How does the issue manifest?" + + - type: textarea + validations: + required: true + attributes: + label: "Minimum reproduction config" + description: "Enter a URL to a failed build or write a config example to reproduce the issue" + placeholder: "https://app.circleci.com/..." + + - type: textarea + attributes: + label: "Other" + description: | + Anything else you want to share? diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml new file mode 100644 index 0000000..864fd10 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml @@ -0,0 +1,34 @@ +name: "\U0001F4A1 Feature Request" +description: Have an idea for a new feature? Begin by submitting a Feature Request +title: 'Request: ' +labels: [enhancement] +# assignees: '' +body: + - type: checkboxes + attributes: + label: "Is there an existing issue that is already proposing this?" + description: "Please search [here](https://github.com/CircleCI-Public/circleci-config-sdk-ts/issues?q=is%3Aissue) to see if an issue already exists for the feature you are requesting" + options: + - label: "I have searched the existing issues" + required: true + + - type: textarea + validations: + required: true + attributes: + label: "Describe the problem imposed by not having this feature" + description: "Please describe the use-case you are attempting to implement, and the current limitations you are facing." + + - type: textarea + validations: + required: true + attributes: + label: "Describe the solution you'd like" + description: "A clear and concise description of what you want to happen. Add any considered drawbacks" + + + - type: textarea + attributes: + label: "Other" + description: | + Anything else you want to share? \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE/PULL_REQUEST.md b/.github/PULL_REQUEST_TEMPLATE/PULL_REQUEST.md new file mode 100644 index 0000000..6b802b2 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/PULL_REQUEST.md @@ -0,0 +1,25 @@ +## PR Type +What kind of change does this PR introduce? + + +- [ ] Bugfix +- [ ] Feature +- [ ] Code style update (formatting) +- [ ] Refactoring (no functional changes) +- [ ] CI related changes +- [ ] Other... Please describe: + +## What is the current behavior? + + +Issue Number: N/A + +## What is the new behavior? + +## Does this PR introduce a breaking change? +- [ ] Yes +- [ ] No + + + +## Other information diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c88c1b --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# orb.yml is "packed" from source, and not published directly from the repository. +orb.yml +.DS_Store \ No newline at end of file diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..c9a8a2e --- /dev/null +++ b/.yamllint @@ -0,0 +1,7 @@ +extends: relaxed + +rules: + line-length: + max: 200 + allow-non-breakable-inline-mappings: true + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..622e8e5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 zygopleural + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..05f8e27 --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +# snaplet-circleci-orb + + + +[Snaplet] gives developers production-accurate PostgreSQL data and preview databases that they can code against. +It does this by capturing a 'snapshot' of a database, copying the schema, and providing a JavaScript runtime for transforming, reducing (subsetting) and generating synthetic data. +Developers can then share these snapshots with their team for collaborative development. + +--- + +## Resources + +[CircleCI Orb Registry Page](https://circleci.com/orbs/registry/orb/zygopleural/snaplet) - The official registry page of this orb for all versions, executors, commands, and jobs described. + +[CircleCI Orb Docs](https://circleci.com/docs/2.0/orb-intro/#section=configuration) - Docs for using, creating, and publishing CircleCI Orbs. + +### How to Contribute + +We welcome [issues](https://github.com/zygopleural/snaplet-circleci-orb/issues) to and [pull requests](https://github.com/zygopleural/snaplet-circleci-orb/pulls) against this repository! + +### How to Publish An Update +1. Merge pull requests with desired changes to the main branch. + - For the best experience, squash-and-merge and use [Conventional Commit Messages](https://conventionalcommits.org/). +2. Find the current version of the orb. + - You can run `circleci orb info zygopleural/snaplet | grep "Latest"` to see the current version. +3. Create a [new Release](https://github.com/zygopleural/snaplet-circleci-orb/releases/new) on GitHub. + - Click "Choose a tag" and _create_ a new [semantically versioned](http://semver.org/) tag. (ex: v1.2.3) + - We will have an opportunity to change this before we publish if needed after the next step. +4. Click _"+ Auto-generate release notes"_. + - This will create a summary of all of the merged pull requests since the previous release. + - If you have used _[Conventional Commit Messages](https://conventionalcommits.org/)_ it will be easy to determine what types of changes were made, allowing you to ensure the correct version tag is being published. +5. Now ensure the version tag selected is semantically accurate based on the changes included. +6. Click _"Publish Release"_. + - This will push a new tag and trigger your publishing pipeline on CircleCI. + +[Snaplet]: https://www.snaplet.dev/ \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..9b62844 --- /dev/null +++ b/app/.gitignore @@ -0,0 +1,2 @@ +.snaplet/snapshots +.snaplet/structure.d.ts diff --git a/app/.snaplet/config.json b/app/.snaplet/config.json new file mode 100644 index 0000000..e4f0640 --- /dev/null +++ b/app/.snaplet/config.json @@ -0,0 +1,5 @@ +{ + "projectId": "cl6z5sjbk17740357lyeea4w7jj", + "databaseUrl": "postgresql://snaplet:snaplet@localhost:5432/snaplet", + "publicKey": "-----BEGIN RSA PUBLIC KEY-----\nMIIBigKCAYEAu4Rb//5qrpqkywKuo8nfJZU+aYzg2DUn9+UpIrJnoqjh/1kBzWEZ\nT7cbw85Kk3+wTTIfGJrZAISEzTgGZpO380uKIOL//LeeZhQFE4jVokjcb35suKb2\nrho7YceaDxDJxrEDeFliZDs5sh9vZ++cN+IkEpBzT598bNdrOWVe6K/uKiy/mSd0\nCtz3kWqfPatUjcZRG5RxlTC8t5nBdnKJ3VvCjJF4xvfDas9fm0v1lyrylc8xPuhC\ndgrhNu2Blwwi1D4xVAM0tn5MVnWVPz+zQSBG5/P3f5i9QFEa1LxzPwCapoxjPvaJ\nlaFnVDogzilbeg9ATT/OMAxTcpx7ACLVYdsmpdCEtsnFOJyeBlcd8yKl9tq8XDG9\nivzcpBjskdgj4b3QsWGylN8BOuCHvNotH2psLJvO/NHhvSDWoEy+EPW/XL4vK3Hz\nJPoPYhpz7WjQOBg6KoVb1yNQdaNFXAB2V3fq6Daj3OBKksOSRuuG5VwkAGR19OCE\nJMO+5o4DmbIdAgMBAAE=\n-----END RSA PUBLIC KEY-----\n" +} \ No newline at end of file diff --git a/app/.snaplet/id_rsa b/app/.snaplet/id_rsa new file mode 100644 index 0000000..018a11a --- /dev/null +++ b/app/.snaplet/id_rsa @@ -0,0 +1,42 @@ +NOTE: This private key is used to decrypt snapshots. +Do not share this with entities that should not be able to decrypt your snapshots. + +-----BEGIN RSA PRIVATE KEY----- +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 +-----END RSA PRIVATE KEY----- diff --git a/app/.snaplet/manifest.json b/app/.snaplet/manifest.json new file mode 100644 index 0000000..b6a9962 --- /dev/null +++ b/app/.snaplet/manifest.json @@ -0,0 +1,3 @@ +{ + "version": "0.13.4" +} diff --git a/app/.snaplet/transform.ts b/app/.snaplet/transform.ts new file mode 100644 index 0000000..3914e94 --- /dev/null +++ b/app/.snaplet/transform.ts @@ -0,0 +1,6 @@ +// This transform config was generated by Snaplet. +// Snaplet found fields that may contain personally identifiable information (PII) +// and used that to populate this file. +import { copycat, faker } from "@snaplet/copycat"; +import type { Transform } from "./structure"; +export const config: Transform = () => ({}); diff --git a/app/docker-compose.yaml b/app/docker-compose.yaml new file mode 100644 index 0000000..46481f0 --- /dev/null +++ b/app/docker-compose.yaml @@ -0,0 +1,22 @@ +version: "3" + +services: + postgres: + image: postgres:14-alpine + environment: + POSTGRES_USER: snaplet + POSTGRES_PASSWORD: snaplet + POSTGRES_DB: snaplet + ports: + - "5432:5432" + volumes: + - ./migration.sql:/docker-entrypoint-initdb.d/docker_postgres_init.sql + - app-volume:/var/lib/postgresql/data + healthcheck: + test: ["CMD", "pg_isready", "-U", "postgres"] + interval: 10s + timeout: 5s + retries: 5 + +volumes: + app-volume: # diff --git a/app/migration.sql b/app/migration.sql new file mode 100644 index 0000000..42d7f36 --- /dev/null +++ b/app/migration.sql @@ -0,0 +1,12 @@ +-- CreateEnum +CREATE TYPE "CatBreed" AS ENUM ('ABYSSINIAN', 'BURMESE', 'CYMRIC', 'DWELF'); + +-- CreateTable +CREATE TABLE "cats" ( + "id" SERIAL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "name" TEXT NOT NULL, + "breed" "CatBreed" NOT NULL, + + CONSTRAINT "cats_pkey" PRIMARY KEY ("id") +); diff --git a/src/@orb.yml b/src/@orb.yml new file mode 100755 index 0000000..ef4841b --- /dev/null +++ b/src/@orb.yml @@ -0,0 +1,11 @@ +version: 2.1 + +description: | + Snaplet gives developers production-accurate PostgreSQL data and preview databases that they can code against. + It does this by capturing a 'snapshot' of a database, copying the schema, and providing a JavaScript runtime for + transforming, reducing (subsetting) and generating synthetic data. + Developers can then share these snapshots with their team for collaborative development. + +display: + home_url: https://github.com/zygopleural/snaplet-circleci-orb + source_url: https://github.com/zygopleural/snaplet-circleci-orb diff --git a/src/README.md b/src/README.md new file mode 100644 index 0000000..b8e1015 --- /dev/null +++ b/src/README.md @@ -0,0 +1,26 @@ +# Orb Source + +Orbs are shipped as individual `orb.yml` files, however, to make development easier, it is possible to author an orb in _unpacked_ form, which can be _packed_ with the CircleCI CLI and published. + +The default `.circleci/config.yml` file contains the configuration code needed to automatically pack, test, and deploy any changes made to the contents of the orb source in this directory. + +## @orb.yml + +This is the entry point for our orb "tree", which becomes our `orb.yml` file later. + +Within the `@orb.yml` we generally specify 4 configuration keys + +**Keys** + +1. **version** + Specify version 2.1 for orb-compatible configuration `version: 2.1` +2. **description** + Give your orb a description. Shown within the CLI and orb registry +3. **display** + Specify the `home_url` referencing documentation or product URL, and `source_url` linking to the orb's source repository. +4. **orbs** + (optional) Some orbs may depend on other orbs. Import them here. + +## See: + - [Orb Author Intro](https://circleci.com/docs/2.0/orb-author-intro/#section=configuration) + - [Reusable Configuration](https://circleci.com/docs/2.0/reusing-config) diff --git a/src/commands/restore.yml b/src/commands/restore.yml new file mode 100755 index 0000000..2f06647 --- /dev/null +++ b/src/commands/restore.yml @@ -0,0 +1,41 @@ +description: | + Snaplet gives developers production-accurate PostgreSQL data and preview databases that they can code against. + It does this by capturing a 'snapshot' of a database, copying the schema, and providing a JavaScript runtime for + transforming, reducing (subsetting) and generating synthetic data. + Developers can then share these snapshots with their team for collaborative development. + +parameters: + token: + description: | + Set the private repository token as the value of the + variable SNAPLET_ACCESS_TOKEN using CircleCI Environment Variables. + type: env_var_name + default: SNAPLET_ACCESS_TOKEN + validate: + description: | + Validate the downloaded binary before performing restore. + type: boolean + default: true + when: + description: | + When should this step run? + type: string + default: "always" + +steps: + - run: + name: Download Snaplet binary + command: <> + when: << parameters.when >> + + - when: + condition: << parameters.validate >> + steps: + - run: + name: Validate Snaplet binary + command: <> + - run: + name: Restore latest snapshot + command: <> + environment: + SNAPLET_ACCESS_TOKEN_ENV_VAR_NAME: << parameters.token >> diff --git a/src/examples/example.yml b/src/examples/example.yml new file mode 100755 index 0000000..7545709 --- /dev/null +++ b/src/examples/example.yml @@ -0,0 +1,31 @@ +description: | + Example restoration of a PostgreSQL DB +usage: + version: 2.1 + orbs: + snaplet: zygopleural/snaplet@1.2.3 + jobs: + checkout-and-restore: + docker: + - image: cimg/base:current + - image: cimg/postgres:14.0 + environment: + POSTGRES_USER: snaplet + POSTGRES_PASSWORD: snaplet + POSTGRES_DB: snaplet + environment: + PGPASSWORD: snaplet + steps: + - checkout: + path: ~/repo + - run: + name: Waiting for Postgres to be ready + command: dockerize -wait tcp://localhost:5432 -timeout 1m + - run: + name: Initial migration + command: psql --host localhost --username snaplet --dbname snaplet --echo-all --file ./migration.sql + - snaplet/restore + workflows: + ci: + jobs: + - checkout-and-restore diff --git a/src/scripts/download.sh b/src/scripts/download.sh new file mode 100644 index 0000000..2d65329 --- /dev/null +++ b/src/scripts/download.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +curl -sL https://app.snaplet.dev/get-cli/ | bash diff --git a/src/scripts/restore.sh b/src/scripts/restore.sh new file mode 100644 index 0000000..872019d --- /dev/null +++ b/src/scripts/restore.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +SNAPLET_ACCESS_TOKEN="${!SNAPLET_ACCESS_TOKEN_ENV_VAR_NAME}" \ + snaplet snapshot restore --data-only \ No newline at end of file diff --git a/src/scripts/validate.sh b/src/scripts/validate.sh new file mode 100644 index 0000000..b7401bc --- /dev/null +++ b/src/scripts/validate.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +echo "Waiting for checksums to be published"