Skip to content

Hold the nodejs dependencies needed to build oVirt JavaScript applications with yarn offline

License

Apache-2.0, Unknown licenses found

Licenses found

Apache-2.0
LICENSE
Unknown
LICENSE-yarn
Notifications You must be signed in to change notification settings

oVirt/ovirt-engine-nodejs-modules

Repository files navigation

ovirt-engine-nodejs-modules

last build

Summary

This package contains the dependencies needed to build oVirt JavaScript applications. By using this package, a project can use nodejs dependencies and build without downloading packages.

Usage

Modify your build script and/or CI job configuration to ensure this packages is installed when building your project:

  • ovirt-engine-nodejs-modules

It’s highly recommended to specify an explicit version and release when requiring the ovirt-engine-nodejs-modules package in your project. For example, in your rpm.spec file:

BuildRequires: ovirt-engine-nodejs-modules >= 2.3.0-1

Note that ovirt-engine-nodejs-modules requires nodejs and takes care of installing the yarn package manager.

Build script

In your build script, source setup-env.sh to set up the Node.js environment and run yarn install to populate the ./node_modules directory:

cd /path/to/your/project
source /usr/share/ovirt-engine-nodejs-modules/setup-env.sh

The setup script runs yarn install in offline mode, using JavaScript package sources located at:

/usr/share/ovirt-engine-nodejs-modules/yarn-offline-cache

If the setup-env.sh command fails, it usually means that you need to add a pre-seed and rebuild the ovirt-engine-nodejs-modules RPM so the offline cache directory will be updated to contains all dependencies currently required by your project or pull request.

Using this package in a project

Simply modify the projects.list.mjs JavaScript file, adding the project’s git information. The git repository will be fetched to access the project’s package.json and yarn.lock file.

Both package.json and yarn.lock are mandatory in the target project. The build will fail if any of those files are not available.

For example, in the projects section of projects.list.mjs, the following block references a git repo, branch (any commitish will work) and folder to be included in the package:

    'ovirt-web-ui': {
      git_url: 'https://github.com/oVirt/ovirt-web-ui.git',
      branch: 'master',
      folder: '/',
    },

Package versioning

The project is version is the standard x.y.z-release format. In general, only bump the x number for major project changes.

When adding a project to the projects.list.mjs file, bump .y in Version and reset the Release number.

When rebuilding the package to pickup changes in the projects listed in the projects.list.mjs file, bump .z in Version and reset the Release number.

When adding a pre-seed source to the pre-seeds.list.mjs file, bump .y in Version and reset the Release number.

When adding or removing a specific pull request pre-seed, bump .z in Version and reset the Release number.

Bump the Release number for a rebuild with the same project and pre-seed configurations.

Pre-seed

If you need dependencies to build a pull request where changes to package.json or yarn.lock are not yet merged, you can add a manual pre-seed based on a GitHub pull request. This avoids a chicken and egg problem.

Summary

Adding a pre-seed is as easy as adding a reference to a pull request with the package.json and/or yarn.lock changes.

The check CI script will only pass if all pre-seeds are linked to an open pull request.

NOTE: Pre-seeds for merged or closed pull-requests patches must be removed for CI to pass.

For example

To pre-seed from a GitHub pull request 42 against the oVirt/ovirt-web-ui project, update the pre-seeds.list.mjs file to look like:

    'ovirt-web-ui': {
      github: {
        owner: 'oVirt',
        repo: 'ovirt-web-ui'
      },
      folder: '/',
      pr: [
        42,
      ]
    },

Any number of project and PRs per project can be listed.

After a pull request adding a pre-seed is merged, the newly built version of ovirt-engine-nodejs-modules will now be pre-seeded with the new package.json and yarn.lock requirements. Offline CI builds of the source pre-seed will now work.

About

Hold the nodejs dependencies needed to build oVirt JavaScript applications with yarn offline

Resources

License

Apache-2.0, Unknown licenses found

Licenses found

Apache-2.0
LICENSE
Unknown
LICENSE-yarn

Stars

Watchers

Forks

Languages