Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add package command #106

Merged
merged 12 commits into from
Dec 18, 2023
Merged

feat: Add package command #106

merged 12 commits into from
Dec 18, 2023

Conversation

erezrokah
Copy link
Member

Adds a package to Docker command to the JavaScript SDK.
This is a breaking change as it also updates the minimum required version to latest Node.js LTS (20) and updates relevant dependencies.

There's a test to build the MemDB plugins that comes with the SDK, but I'll test with the Airtable plugin too

BEGIN_COMMIT_OVERRIDE
feat: Add package command

chore: Require Node.js 20
BREAKING-CHANGE: Require Node.js 20

END_COMMIT_OVERRIDE

@@ -19,13 +19,13 @@
"./types/*": "./dist/types/*.js"
},
"scripts": {
"dev": "ts-node --esm src/main.ts serve",
"dev": "node --no-warnings=ExperimentalWarning --loader ts-node/esm src/main.ts",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erezrokah erezrokah force-pushed the feat/add_package_command branch 5 times, most recently from c61a206 to 07408dd Compare December 14, 2023 11:06
@erezrokah erezrokah marked this pull request as ready for review December 14, 2023 11:10
await runDockerCommand(
logger,
[
'buildx',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need buildx to cross platform images work inside GitHub Actions, we do the same in our current publishing pipeline https://github.com/cloudquery/cloudquery/blob/d91bda9afbd2e322beabc8a9bf34a2f0cd7407f5/.github/workflows/release_plugin.yml#L79

await runDockerCommand(logger, dockerSaveArguments, pluginDirectory);
const checksum = await computeHash(imagePath);
// eslint-disable-next-line @typescript-eslint/naming-convention
return { os, arch, path: imageTar, checksum, docker_image_tag: imageTag };
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added docker_image_tag as that is needed for the push command in the CLI.
We can also reconstruct the tag based on information we have in the CLI, but in case we ever change the tag structure I think this way is better

@@ -66,12 +84,26 @@ export const newUnimplementedDestination = (): DestinationClient => {
};
};

export const newPlugin = (name: string, version: string, newClient: NewClientFunction): Plugin => {
const defaultBuildTargets: BuildTarget[] = [
{ os: 'linux', arch: 'amd64' },
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erezrokah erezrokah added the automerge Add to automerge PRs once requirements are met label Dec 14, 2023
@erezrokah
Copy link
Member Author

So I was able to push the images generated by this PR on the MemDB plugin to GitHub via the CLI code:
image

@erezrokah erezrokah merged commit f2f7931 into main Dec 18, 2023
6 checks passed
@erezrokah erezrokah deleted the feat/add_package_command branch December 18, 2023 08:43
kodiakhq bot pushed a commit to cloudquery/cloudquery that referenced this pull request Dec 29, 2023

#### Summary

Example (images generated with cloudquery/plugin-sdk-javascript#106)
![image](https://github.com/cloudquery/cloudquery/assets/26760571/e51f90a2-2af3-4d09-8039-92343eebe16a)

The images were generated by cloudquery/plugin-sdk-javascript#106 (replacing `registry.cloudquery.io` with `ghcr.io`)

### TODO

- [ ] Merge the different platforms into a single image with `docker manifest`. The is done by `docker buildx --push` automatically at the moment in https://github.com/cloudquery/cloudquery/blob/67c10c38a04dcdd1512bf6dc739f89bc11baa888/.github/workflows/release_plugin.yml#L94

<!--
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Add to automerge PRs once requirements are met
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant