Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
"matchDatasources": ["npm"],
"addLabels": ["javascript"],
"automerge": false
},
{
"matchPackageNames": ["node"],
"allowedVersions": "/22.[0-9]+.[0-9]+(.[0-9]+)?$/"
}
],
"customManagers": [
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/frontend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: frontend

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Extract versions from pom.xml
id: extract_versions
run: |
NODE_VERSION=$(sed -n 's/.*<node.version>\(.*\)<\/node.version>.*/\1/p' pom.xml)
NPM_VERSION=$(sed -n 's/.*<npm.version>\(.*\)<\/npm.version>.*/\1/p' pom.xml)
echo "NODE_VERSION=$NODE_VERSION" >> "$GITHUB_ENV"
echo "NPM_VERSION=$NPM_VERSION" >> "$GITHUB_ENV"
- uses: actions/setup-node@v4
with:
node-version: "${{ env.NODE_VERSION }}"
cache: "npm"
- run: npm install --global 'npm@${{ env.NPM_VERSION }}'
- run: npm ci
- run: npm run lint
- run: npm run build
- run: npm test
4 changes: 2 additions & 2 deletions .github/workflows/jenkins-security-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- main
pull_request:
types: [ opened, synchronize, reopened ]
types: [opened, synchronize, reopened]
workflow_dispatch:

permissions:
Expand All @@ -17,5 +17,5 @@ jobs:
security-scan:
uses: jenkins-infra/jenkins-security-scan/.github/workflows/jenkins-security-scan.yaml@v2
with:
java-cache: 'maven' # Optionally enable use of a build dependency cache. Specify 'maven' or 'gradle' as appropriate.
java-cache: "maven" # Optionally enable use of a build dependency cache. Specify 'maven' or 'gradle' as appropriate.
# java-version: 21 # Optionally specify what version of Java to set up for the build, or remove to use a recent default.
16 changes: 6 additions & 10 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
/*
!/src
/src/*
!/src/main
!/src/main/
/src/main/*
!/src/main/frontend
!/package.json
!/tsconfig.json
!/.prettierrc.json
!/eslint.config.js
!/vite.config.ts
!/vitest.config.ts
!/src/main/frontend/

/.mvn/*
/Jenkinsfile
/pom.xml
50 changes: 30 additions & 20 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Contributing

**Never report security issues on GitHub, public Jira issues or other public channels (Gitter/Twitter/etc.),
follow the instruction from [Jenkins Security](https://www.jenkins.io/security/#reporting-vulnerabilities) to
**Never report security issues on GitHub, public Jira issues or other public channels (Gitter/Twitter/etc.),
follow the instruction from [Jenkins Security](https://www.jenkins.io/security/#reporting-vulnerabilities) to
report it on [Jenkins Jira](https://issues.jenkins.io/)**

In the Jenkins project we appreciate any kind of contributions: code, documentation, design, etc.
Expand All @@ -11,68 +11,69 @@ Check out [this page](https://jenkins.io/participate/) for more information and
Many plugins and components also define their own contributing guidelines and communication channels.
There is also a big number of [mailing lists](https://jenkins.io/mailing-lists/) and [chats](https://jenkins.io/chat/).


## Newcomers

If you are a newcomer contributor and have any questions, please do not hesitate to ask in the [Newcomers Gitter channel](https://gitter.im/jenkinsci/newcomer-contributors).

## Useful links

* [Jenkins: Participate and Contribute](https://jenkins.io/participate/)
* [Slides: Contributing to Jenkins - it is all about you](https://docs.google.com/presentation/d/1JHgVzWZAx95IsUAZp8OoyCQGGkrCjzUd7eblwd1Y-hA/edit?usp=sharing)
- [Jenkins: Participate and Contribute](https://jenkins.io/participate/)
- [Slides: Contributing to Jenkins - it is all about you](https://docs.google.com/presentation/d/1JHgVzWZAx95IsUAZp8OoyCQGGkrCjzUd7eblwd1Y-hA/edit?usp=sharing)

### Source code contribution ways of working

- For larger contributions create an issue for any required discussion
- Implement solution on a branch in your fork
- Make sure to include issue ID (if created) in commit message, and make the message speak for itself
- Once you're done create a pull request and ask at least one of the maintainers for review
- Remember to title your pull request properly as it is used for release notes
- Remember to title your pull request properly as it is used for release notes

## Run Locally

Prerequisites: _Java_ and _Maven_.

- Ensure Java 17 or 21 is available.

```console
```console
$ java -version
openjdk 17.0.13 2024-10-15
OpenJDK Runtime Environment (build 17.0.13+11-Ubuntu-2ubuntu124.04)
OpenJDK 64-Bit Server VM (build 17.0.13+11-Ubuntu-2ubuntu124.04, mixed mode, sharing)
```
```

- Ensure Maven >= 3.9.9 is installed and included in the PATH environment variable.

```console
$ mvn --version
```
mvn --version
```

### IDE configuration

See [IDE configuration](https://jenkins.io/doc/developer/development-environment/ide-configuration/)

### CLI

```console
$ mvn hpi:run
```
```console
mvn hpi:run
```

```text
...
INFO: Jenkins is fully up and running
```text
...
INFO: Jenkins is fully up and running
```

### Building frontend code

To work on the frontend code, two processes are needed at the same time:

On one terminal, start a development server that will not process frontend assets:

```sh
mvn hpi:run -Dskip.npm -P quick-build
```

On another terminal, start a [vite](https://vite.dev/) build command that automatically rebuilds on code changes:

```sh
npm run build:dev
```
Expand All @@ -81,11 +82,20 @@ It's recommended that you set up the above terminal commands in your IDE of choi

### Build and package

To generate the hpi package and run the test you can use:
To generate the hpi package and run the plugin tests (except frontend tests) you can use:

```sh
mvn package
```
For a quicker build without the tests run:

To run the frontend tests, you can use:

```sh
npm test
```

For a quicker build without the plugin tests run:

```sh
mvn package -P quick-build
```
Expand All @@ -94,10 +104,10 @@ mvn package -P quick-build

Code style will be enforced by GitHub pull request checks.

For frontend code we use [prettier](https://prettier.io/).
For frontend code we use [eslint](https://eslint.org) and [prettier](https://prettier.io/).

You can automatically fix issues with `npm run lint:fix`

For java code we use [spotless](https://github.com/diffplug/spotless).

You can automatically fix issues with `mvn spotless:apply`
You can automatically fix issues with `mvn spotless:apply`
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ This plugin aims to bring the best of Blue Ocean into the regular Jenkins UI.

That means functionality like:

* [x] Pipeline graph
* [x] Summary of runs in a job (like [Pipeline Stage View Plugin](https://github.com/jenkinsci/pipeline-stage-view-plugin/), but simpler, more modern and more performant)
* [x] Modern logs viewing
- [x] Pipeline graph
- [x] Summary of runs in a job (like [Pipeline Stage View Plugin](https://github.com/jenkinsci/pipeline-stage-view-plugin/), but simpler, more modern and more performant)
- [x] Modern logs viewing

The plugin should be lightweight, using or providing extension points where possible rather than building everything into one plugin.

Expand Down
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
{
"name": "pipeline-graph-view-plugin",
"version": "1.0.0",
"version": "0.0.0-development",
"description": "Pipeline Graph visualization for Jenkins pipelines",
"private": true,
"type": "module",
"scripts": {
"mvnbuild": "npm run build",
"mvntest": "npm test",
"mvntest": "echo \"Tests should be executed through 'npm test' instead\"",
Copy link
Member

Choose a reason for hiding this comment

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

we still want this to be run through the maven build so that a full build is tested for both java and javascript.

People can skip the running of the tests easily with e.g. quick-build profile and on CI I don't think it matters much

"build": "vite build --mode production",
"build:dev": "vite build --mode development --watch",
"lint": "tsc && eslint && prettier --check .",
"lint:fix": "eslint --fix && prettier --write .",
"test": "vitest --watch=false --reporter default --reporter junit && npm run lint",
"test:dev": "vitest --watch"
"build:dev": "vite build --mode production --watch",
"format:check": "prettier --check .",
"format": "prettier --write .",
"lint": "tsc && eslint && npm run format:check",
"lint:fix": "eslint --fix && npm run format",
"test": "vitest run",
"test:dev": "vitest watch"
},
"repository": {
"type": "git",
Expand Down
4 changes: 0 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@
<node.version>22.15.0</node.version>
<npm.version>11.3.0</npm.version>
<spotless.check.skip>false</spotless.check.skip>

<!-- Opt in to Jenkins handling eslint results -->
<maven.test.failure.ignore>false</maven.test.failure.ignore>
<frontend.testFailureIgnore>${maven.test.failure.ignore}</frontend.testFailureIgnore>
Copy link
Member

Choose a reason for hiding this comment

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

this also has the benefit that check annotations show up in the GitHub UI which is a nice feature, so not sure if we want to remove this

</properties>

<dependencyManagement>
Expand Down
7 changes: 7 additions & 0 deletions src/main/frontend/pipeline-graph-view/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@

// Render App
root.render(<App />);

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const unusedVariable = "intentional typescript failure";

const _not_camel_case = "intentional eslint failure"

Check failure on line 15 in src/main/frontend/pipeline-graph-view/index.tsx

View workflow job for this annotation

GitHub Actions / ci

Identifier '_not_camel_case' is not in camel case

console.log(_not_camel_case) // intentional prettier failure
5 changes: 0 additions & 5 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import { defineConfig } from "vitest/config";
import path from "node:path";

export default defineConfig({
test: {
root: "src/main/frontend",
globals: true,
environment: "jsdom",
setupFiles: ["setupTests.ts"],
outputFile: path.resolve(
import.meta.dirname,
"target/surefire-reports/vitest-junit.xml",
),
},
});
Loading