{"id":12959,"library":"ci-build-tools","title":"CI Build Tools for Node.js","description":"This library provides helper functions designed for Continuous Integration (CI) environments, specifically Travis-CI and JenkinsCI with Stash integration. Its primary features include automatically determining project versions based on branch names, publishing Git tags to the repository, and managing downstream branch merges (e.g., from `release` to `master`). The current stable version is 1.0.13, released several years ago, indicating an inactive development pace. Key differentiators include its tight integration with Travis-CI through specific `.travis.yml` encryption methods and its ability to infer versioning and automate Git operations within CI pipelines, aiming to reduce manual configuration and script complexity between build tasks and the CI platform. Due to its age, compatibility with modern Node.js versions or current CI platform features may be limited.","status":"abandoned","version":"1.0.13","language":"javascript","source_language":"en","source_url":"https://github.com/wparad/node-ci-build-tools","tags":["javascript","Travis-CI","Jenkins-CI","package creation","microservice"],"install":[{"cmd":"npm install ci-build-tools","lang":"bash","label":"npm"},{"cmd":"yarn add ci-build-tools","lang":"bash","label":"yarn"},{"cmd":"pnpm add ci-build-tools","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The module exports a function that must be immediately invoked with a `GIT_TAG_PUSHER` value (typically from `process.env`) to return the CI tools object. This package does not support ESM `import` syntax.","wrong":"import ci from 'ci-build-tools';\nconst ci = require('ci-build-tools');","symbol":"ci-build-tools module (initializer)","correct":"const ci = require('ci-build-tools')(process.env.GIT_TAG_PUSHER ?? '');"},{"note":"`GetVersion` is a method on the object returned by the module's initialization function, not a direct module export.","wrong":"import { GetVersion } from 'ci-build-tools';","symbol":"GetVersion","correct":"ci.GetVersion();"},{"note":"`PublishGitTag` is a method on the initialized CI tools object, requiring the `ci` object to be correctly set up first.","wrong":"import { PublishGitTag } from 'ci-build-tools';","symbol":"PublishGitTag","correct":"ci.PublishGitTag();"},{"note":"`MergeDownstream` is a method on the initialized CI tools object, designed for specific branch merging strategies.","wrong":"import { MergeDownstream } from 'ci-build-tools';","symbol":"MergeDownstream","correct":"ci.MergeDownstream('release/', 'master');"}],"quickstart":{"code":"// Example .travis.yml setup for GIT_TAG_PUSHER:\n// env:\n//   global:\n//     - GIT_TAG_PUSHER=\"your_encrypted_github_token\" // Encrypted using `travis encrypt GIT_TAG_PUSHER=your_token --add env.global`\n\n// In your CI script (e.g., .travis.yml 'script' section):\n// export GIT_TAG_PUSHER=\"YOUR_GITHUB_TOKEN_HERE\" // For local testing or non-Travis CIs, replace with your actual token or environment variable.\n\n// Initialize CI build tools with the Git tag pusher environment variable.\n// This key needs 'repo_deployment' and 'public_repo' access on GitHub.\nconst ci = require('ci-build-tools')(process.env.GIT_TAG_PUSHER ?? '');\n\n// Check if the CI object was initialized successfully (i.e., GIT_TAG_PUSHER was provided)\nif (!ci) {\n  console.error('CI Build Tools could not be initialized. Ensure GIT_TAG_PUSHER is set.');\n  process.exit(1);\n}\n\n// Get the current version based on the branch name.\n// Assumes a branching strategy like 'release/v1.2.3' or 'master'.\nconst version = ci.GetVersion();\nconsole.log(`Current version determined: ${version}`);\n\n// Automatically publish a tag with the current version to the git repository.\n// This typically happens on successful builds of release branches or master.\nconsole.log(`Attempting to publish Git tag for version: ${version}`);\ntry {\n  ci.PublishGitTag();\n  console.log(`Successfully published Git tag: ${version}`);\n} catch (error) {\n  console.error(`Failed to publish Git tag: ${error.message}`);\n  // Optionally publish a custom tag\n  // ci.PublishGitTag(`custom-tag-${version}-${Date.now()}`);\n}\n\n// Automatically merge downstream branches.\n// Example: if the current branch is `release/v1.0.0`, it attempts to merge into `master`.\n// This operation requires appropriate Git credentials and permissions.\nconsole.log('Attempting to merge downstream branches...');\ntry {\n  ci.MergeDownstream('release/', 'master');\n  console.log('Successfully initiated downstream merge.');\n} catch (error) {\n  console.error(`Failed to merge downstream: ${error.message}`);\n}","lang":"javascript","description":"This code demonstrates how to initialize the `ci-build-tools` library, retrieve the current project version, publish a Git tag, and perform downstream branch merges within a CI environment, highlighting the necessary environment variable `GIT_TAG_PUSHER`."},"warnings":[{"fix":"Consider using actively maintained alternatives for CI/CD automation or fork and update the library to support current environments. Evaluate the security implications of using an unmaintained package.","message":"The `ci-build-tools` package is effectively abandoned, with no updates in over 7 years. Its internal dependencies, API integrations (e.g., with Travis-CI), and compatibility with modern Node.js versions or CI/CD platforms are highly likely to be outdated or broken.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Always initialize the module with `const ci = require('ci-build-tools')(process.env.GIT_TAG_PUSHER ?? '');` ensuring `GIT_TAG_PUSHER` is properly set in your CI environment.","message":"The main module export is a function that requires immediate invocation with `process.env.GIT_TAG_PUSHER`. Attempting to `require` or `import` the module without this invocation will result in a TypeError because methods like `GetVersion` will not exist on the uninitialized object.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consult the latest Travis-CI documentation and GitHub API guidelines for secure credential management and API key scope requirements. Verify the suggested scopes are still appropriate and necessary to avoid security vulnerabilities or access issues.","message":"The setup instructions for Travis-CI rely on specific `travis encrypt` commands and GitHub API key scopes (`repo_deployment`, `public_repo`) that may be deprecated or have changed in modern Travis-CI environments or GitHub's API policy.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure your branching strategy aligns with `release/*` and `master` for automated merges, or be prepared to fork and modify the library's source code to accommodate custom workflows.","message":"The `MergeDownstream` functionality explicitly targets `release/*` and `master` branches by default. Custom branch naming conventions or more complex merging strategies will not be supported without modifying the library's source.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure the module is invoked: `const ci = require('ci-build-tools')(process.env.GIT_TAG_PUSHER);`","cause":"The `ci-build-tools` module was `require`d but not immediately invoked with the `GIT_TAG_PUSHER` argument, leaving `ci` as a function instead of the initialized object.","error":"TypeError: ci.GetVersion is not a function"},{"fix":"Verify that `GIT_TAG_PUSHER` is correctly set and encrypted in your CI environment, and that the GitHub Personal Access Token has the required scopes as outlined in the README.","cause":"The `GIT_TAG_PUSHER` environment variable is either missing, incorrect, or the associated GitHub token lacks the necessary `repo_deployment` and `public_repo` permissions to perform Git operations.","error":"Error: Command failed: git push origin --tags (or similar Git command failure)"},{"fix":"Run `gem install travis` (after `apt-get install ruby-dev` on Debian-based systems) to install the Travis CI client.","cause":"The `travis` Ruby gem, used for encrypting environment variables for Travis-CI, is not installed or not in the system's PATH.","error":"Error: 'travis' command not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}