From 1549df73c1a1dd948afdb9ceef66ed6d0bd74af1 Mon Sep 17 00:00:00 2001 From: Pavlo Voropaiev Date: Mon, 10 Nov 2025 16:56:30 +0200 Subject: [PATCH 1/2] Dockerize the component --- .circleci/build_slug.sh | 10 --- .circleci/config.yml | 134 +++++++++++++++++++++++++++++++++++----- .grype-ignore.yaml | 3 + CHANGELOG.md | 4 ++ component.json | 3 +- 5 files changed, 127 insertions(+), 27 deletions(-) delete mode 100644 .circleci/build_slug.sh create mode 100644 .grype-ignore.yaml diff --git a/.circleci/build_slug.sh b/.circleci/build_slug.sh deleted file mode 100644 index 69c6359..0000000 --- a/.circleci/build_slug.sh +++ /dev/null @@ -1,10 +0,0 @@ -echo "Building slug" -id=$(git archive $CIRCLE_BRANCH | docker run -e "NPM_CONFIG_PRODUCTION=false" -i -a stdin elasticio/appbuilder) -docker attach $id -RC=$? -if [ $RC -eq 0 ];then - echo "Build ok." -else - echo "Build failed" - exit 1 -fi \ No newline at end of file diff --git a/.circleci/config.yml b/.circleci/config.yml index db118cb..9c46af3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,24 +1,128 @@ -version: 2 +version: 2.1 +parameters: + node-version: + type: string + default: "22.18.0" +orbs: + node: circleci/node@5.0.0 + slack: circleci/slack@4.5.3 +commands: + notify_on_failure: + steps: + - slack/notify: + event: fail + custom: | + { + "blocks": [ + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": ":red_circle: *$CIRCLE_PROJECT_REPONAME*:*$CIRCLE_TAG* build failed" + } + ] + }, + { + "type": "actions", + "elements": [ + { + "type": "button", + "text": { + "type": "plain_text", + "text": "View Job" + }, + "url": "${CIRCLE_BUILD_URL}" + } + ] + } + ] + } + notify_on_pass: + steps: + - slack/notify: + event: pass + custom: | + { + "blocks": [ + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": ":tada: *$CIRCLE_PROJECT_REPONAME*:*$CIRCLE_TAG* was successfully built and published" + } + ] + }, + { + "type": "actions", + "elements": [ + { + "type": "button", + "text": { + "type": "plain_text", + "text": "View Job" + }, + "url": "${CIRCLE_BUILD_URL}" + } + ] + } + ] + } jobs: test: docker: - - image: circleci/node:12-stretch + - image: cimg/node:14.21.3 + steps: + - checkout + - node/install: + node-version: << pipeline.parameters.node-version >> + - node/install-packages: + cache-path: ./node_modules + override-ci-command: npm install + # Audit check is disabled until the component is properly made up-to-date + # - run: + # name: Audit Dependencies + # command: npm audit --production --audit-level=high + - run: + name: Running Tests + command: npm test + build: + docker: + - image: cimg/node:14.21.3 + user: root steps: - checkout - - restore_cache: - key: dependency-cache-{{ checksum "package.json" }} + - node/install: + node-version: << pipeline.parameters.node-version >> + - setup_remote_docker: + version: default + docker_layer_caching: true + # build and push Docker image - run: - name: Installing Dependencies - command: npm install - - save_cache: - key: dependency-cache-{{ checksum "package.json" }} - paths: - - node_modules + name: Install component-build-helper lib + command: npm install -g @elastic.io/component-build-helper - run: - name: Running Mocha Integration Tests - command: npm test && npm run integration-test + name: Build and publish docker image + command: build_component_docker + - notify_on_failure + - notify_on_pass workflows: - version: 2 - build_and_test: + test: + jobs: + - test: + name: "Running tests" + filters: + tags: + ignore: /.*/ + publish_release: jobs: - - test + - build: + name: "Build and publish docker image" + context: + - componentspusher + filters: + branches: + ignore: /.*/ + tags: + only: /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/ diff --git a/.grype-ignore.yaml b/.grype-ignore.yaml new file mode 100644 index 0000000..dbe49df --- /dev/null +++ b/.grype-ignore.yaml @@ -0,0 +1,3 @@ +# Ignore all approach. This is to be deleted once the component is properly made up-to-date. +ignore: + - {} diff --git a/CHANGELOG.md b/CHANGELOG.md index 7006b03..2651cfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.4.3 (November 14, 2025) + +* Force the component builds to be dockerized ad pushed to the Docker Hub + ## 1.4.2 (November 26, 2021) * Upgrade sailor version to 2.6.26 diff --git a/component.json b/component.json index c2e0c6c..4ce6f4a 100644 --- a/component.json +++ b/component.json @@ -1,8 +1,7 @@ { "title": "PostgreSQL", - "version": "1.4.2", + "version": "1.4.3-dev.1", "description": "Simple SQL query against a PostgreSQL", - "buildType": "docker", "docsUrl":"https://github.com/elasticio/postgresql-component", "credentials": { "fields": { From c34834a17b1a6a3eb86ec025c1b6f54eb7dbba8f Mon Sep 17 00:00:00 2001 From: Pavlo Voropaiev Date: Thu, 13 Nov 2025 13:36:30 +0200 Subject: [PATCH 2/2] grype --- .grype-ignore.yaml | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .grype-ignore.yaml diff --git a/.grype-ignore.yaml b/.grype-ignore.yaml deleted file mode 100644 index dbe49df..0000000 --- a/.grype-ignore.yaml +++ /dev/null @@ -1,3 +0,0 @@ -# Ignore all approach. This is to be deleted once the component is properly made up-to-date. -ignore: - - {}