Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize component #3

Merged
merged 2 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates
---
version: 2
updates:
- package-ecosystem: "maven"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
4 changes: 4 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# https://github.com/jenkinsci/.github/blob/master/.github/release-drafter.adoc
---
_extends: .github
tag-template: extensibility-$NEXT_MINOR_VERSION
24 changes: 24 additions & 0 deletions .github/workflows/jenkins-security-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Jenkins Security Scan
# For more information, see: https://www.jenkins.io/doc/developer/security/scan/
---
name: Jenkins Security Scan

on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:

permissions:
security-events: write
contents: read
actions: read

jobs:
security-scan:
uses: jenkins-infra/jenkins-security-scan/.github/workflows/jenkins-security-scan.yaml@v2
with:
java-cache: 'maven'
java-version: 11
16 changes: 16 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Automates creation of Release Drafts using Release Drafter
# More Info: https://github.com/jenkinsci/.github/blob/master/.github/release-drafter.adoc
---
on:
push:
branches:
- master

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
target

# mvn hpi:run
work

# IntelliJ IDEA project files
*.iml
*.iws
*.ipr
.idea

# Eclipse project files
.settings
.classpath
.project
7 changes: 7 additions & 0 deletions .mvn/extensions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
<extension>
<groupId>io.jenkins.tools.incrementals</groupId>
<artifactId>git-changelist-maven-extension</artifactId>
<version>1.6</version>
</extension>
</extensions>
2 changes: 2 additions & 0 deletions .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-Pconsume-incrementals
-Pmight-produce-incrementals
9 changes: 9 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* While this is not a plugin, it is much simpler to reuse the pipeline code for CI. This allows for
* easy Linux/Windows testing and produces incrementals. The only feature that relates to plugins is
* allowing one to test against multiple Jenkins versions.
*/
buildPlugin(useContainerAgent: true, configurations: [
[platform: 'linux', jdk: 17],
[platform: 'windows', jdk: 11],
])
56 changes: 36 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,43 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.cloudbees</groupId>
<artifactId>cloudbees-oss-parent</artifactId>
<version>2</version>
<groupId>org.jenkins-ci</groupId>
<artifactId>jenkins</artifactId>
<version>1.98</version>
<relativePath />
</parent>
<groupId>com.cloudbees</groupId>
<artifactId>extensibility</artifactId>
<version>1.6-SNAPSHOT</version>
<version>${revision}${changelist}</version>

<name>CloudBees Extensibility Mechanism</name>
<description>Base layer for extensibility</description>
<url>https://github.com/jenkinsci/${project.artifactId}-api</url>

<properties>
<revision>1.6</revision>
<changelist>-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/${project.artifactId}-api</gitHubRepo>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice-bom</artifactId>
<version>5.1.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>annotation-indexer</artifactId>
<version>1.3</version>
<version>1.17</version>
</dependency>
<dependency>
<groupId>org.kohsuke.metainf-services</groupId>
<artifactId>metainf-services</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<!--
we use this instead of stock Guice because many of our
use cases involves in adding Aether, which requires
this customized version of Guice.
-->
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-inject-plexus</artifactId>
<version>2.3.0</version>
<version>1.9</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.9</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -51,8 +66,9 @@
</licenses>

<scm>
<connection>scm:git:git://github.com/cloudbees/extensibility-api.git</connection>
<developerConnection>scm:git:git@github.com:cloudbees/extensibility-api.git</developerConnection>
<url>http://github.com/cloudbees/extensibility-api</url>
<connection>scm:git:https://github.com/${gitHubRepo}.git</connection>
<developerConnection>scm:git:git@github.com:${gitHubRepo}.git</developerConnection>
<tag>${scmTag}</tag>
<url>https://github.com/${gitHubRepo}</url>
</scm>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package com.cloudbees.sdk.extensibility;

import sun.reflect.annotation.AnnotationParser;

import java.lang.annotation.Annotation;
import java.util.Collections;
import java.util.Map;
Expand All @@ -44,8 +42,4 @@ public static <T extends Annotation> T of(Class<T> type, Object value) {
public static <T extends Annotation> T of(Class<T> type, String key, Object value) {
return of(type, Collections.singletonMap(key,value));
}

public static <T extends Annotation> T of(Class<T> type, final Map<String,?> values) {
return type.cast(AnnotationParser.annotationForMap(type, (Map) values));
}
}