blueocean-plugin
repository·master·Indexed 25 days ago
https://github.com/jenkinsci/blueocean-pluginA Jenkins plugin providing the Blue Ocean user interface and a specialized REST API for programmatic access to pipelines, runs, organizations, and SCM resources. Includes documentation for setting up and running acceptance tests (ATH) using Selenium, Guice DI, and WebDriverMixin, as well as guides for developing the Dashboard plugin and @jenkins-cd/blueocean-core-js.
What's inside blueocean-plugin
- The Blue Ocean events plugin manages the publishing of server-side events that are pushed to the browser using Server-Sent Events (SSE). This mechanism enables the Blue Ocean user interface to remain responsive by reacting to real-time changes occurring on the server side.
Access Blue Ocean Internationalization (i18n) documentation
masterThe
blueocean-i18npackage provides the Internationalization API for Blue Ocean. For detailed implementation details and usage, refer to the official documentation files within the repository:- i18n documentation:
../docu/I18N.md - js-extension documentation:
../js-extensions/README.md
- i18n documentation:
Develop JDL alongside Blue Ocean using slink
masterWhen adding features to JDL that need to be tested within Blue Ocean, use
slinkto perform local installs. This avoids the need to constantly publish to NPM or manually modifypackage.jsonfiles.Follow these steps to set up a development environment where JDL changes are reflected in Blue Ocean modules:
Install slink globally:
npm install -g slinkLocally install JDL into Blue Ocean modules: Navigate to your Blue Ocean module directory (e.g.,
blueocean-web) and runnpm installpointing to your local JDL checkout. Do not use the--saveflag; this ensures the change is temporary and can be undone by running a standardnpm installormvn clean installlater.Watch for JDL changes: In the
jenkins-design-languagedirectory, rungulp watch.Slink the JDL directory in each module: In each Blue Ocean module directory (e.g.,
blueocean-web,blueocean-dashboard), runslinkpointing to your local JDL checkout. This is necessary becauseblueocean-webexports shared instances of modules viajs-modules, and other plugins must watch for changes in the linked source.Watch for Blue Ocean changes and rebundle: In the
blueocean-webdirectory, rungulp bundle:watch. This triggers a cascading rebundle: JDL changes trigger aslinkupdate, which in turn triggers theblueocean-webrebundle.
Develop components using React Storybook
masterYou can develop GUI components in isolation without a running Jenkins instance using React Storybook.
Start the Storybook server:
npm run storybookThe server will start on port 9001 and refresh automatically on changes.
Writing Stories: Create a story file (e.g.,
src/main/js/components/stories/button.js) to define different views of your component usingstoriesOfandactionfrom@kadira/storybook.Registering Stories: You must register your new story files in the Storybook configuration. You can either add them to
.storybook/config.jsor, preferably, add them to the central index file atsrc/main/js/components/stories/index.js.
npm run storybookInstall and develop with Jenkins Design Language (JDL)
masterTo set up the development environment for the Jenkins Design Language (JDL) reusable React components, follow these steps:
- Install dependencies using
npm install. - Run the gulp task with
npm run gulp. - Build the Storybook documentation with
npm run build-storybook. - Start the local site server with
npm run site-serverto view the components.
npm install npm run gulp npm run build-storybook npm run site-server- Install dependencies using
Run BlueOcean Aggregator in development
masterTo start the BlueOcean Aggregator for development or testing, ensure you have first run
mvn clean installfrom the parent directory. Then, execute the following command in the aggregator directory:mvn hpi:runOnce running, you can access the following interfaces:
- Blue Ocean UI:
http://localhost:8080/jenkins/blue - Embedded Jenkins UI:
http://localhost:8080/jenkins
mvn hpi:run- Blue Ocean UI:
Develop and test JDL components with Storybook
masterTo develop JDL components in isolation without the overhead of Jenkins plugins, use React Storybook. This starts a local webpack server at
http://localhost:9001/that watches for JavaScript changes. Stories are located in/src/js/stories/.Note: Storybook does not automatically watch and rebuild CSS from
.lessfiles. If you modify styles, you must run thewatch-stylesGulp task separately.Run Blue Ocean Acceptance Tests
masterUse the provided shell script to execute tests. This is primarily intended for CI environments.
Run all tests
Starts the Selenium Docker container and runs all Java ATH tests.
./run.shRun with Bitbucket fallback
If Docker fails to start the Bitbucket test, use the
-ldflag:./run.sh -ldRun against a local instance
To run tests against a local development instance (e.g., using a local ChromeDriver), create a properties file at
~/.blueocean-ath-configwith the following keys:Key Description webDriverTypee.g., chromewebDriverUrlURL of the driver (e.g., http://localhost:9515)webDriverBrowserSizeOptional: e.g., 1024x768jenkinsUrlOptional: URL of the Jenkins instance adminUsernameOptional: Admin username adminPasswordOptional: Admin password Convert UTF-8 to ISO-8859-1 for Java Properties
masterSince Java properties files in Jenkins core support only
iso-8859-1, special characters (likeñ) must be converted to their Unicode escape sequences (e.g.,\u00F1). Use thenative2asciitool provided in the JDK to ensure compatibility.native2ascii Messages_fr.properties Messages_fr.properties.new mv Messages_fr.properties.new Messages_fr.propertiesUpgrade Blue Ocean plugins
masterWhen upgrading, always update the main Blue Ocean plugin rather than individual sub-plugins. Updating the main plugin ensures that all dependent plugins and libraries are upgraded in a compatible manner.Install @jenkins-cd/js-extensions
masterThe@jenkins-cd/js-extensionsmodule is published via npm. It allows plugins (both within the BlueOcean project and external ones) to define extension points and provide UI implementations for the Jenkins BlueOcean interface.Lint code with ESLint
masterThe project uses ESLint with React linting options. Use the following commands to maintain code quality:
npm run lint: Runs the linting process.npm run lint:fix: Attempts to automatically fix linting offenses.gulp lint:watch --continueOnLint: Runs linting in watch mode, providing rapid feedback as you save files.
npm run lint npm run lint:fix gulp lint:watch --continueOnLint