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 plugin build #13

Merged
merged 5 commits into from
Oct 7, 2021
Merged
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
Binary file added .github/build-and-publish.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "maven"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
2 changes: 2 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
_extends: .github
tag-template: amazon-ecr-$NEXT_MINOR_VERSION
17 changes: 17 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Automates creation of Release Drafts using Release Drafter
# More Info: https://github.com/jenkinsci/.github/blob/master/.github/release-drafter.adoc
name: Update Release Draft

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/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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.2</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
54 changes: 54 additions & 0 deletions CHANGELOG.old.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Old Changelog

This is the old changelog imported from the Jenkins wiki, for newer changes see
[GitHub Releases](https://github.com/jenkinsci/amazon-ecr-plugin/releases).

## 1.6 (2017-05-16)

- [JENKINS-34437](https://issues.jenkins-ci.org/browse/JENKINS-34437) Enable
amazon-ecr-plugin behind proxy
- Performance improvements
- Set minor version to 1.642.1
- Upgrade Credentials Plugin
- Upgrade AWS Java SDK Plugin
- Upgrade AWS Credentials Plugin
- Upgrade Docker Commons Plugin
- improve log

## 1.5 - Burned

## 1.4 (2016-10-29)

- [JENKINS-38465](https://issues.jenkins-ci.org/browse/JENKINS-38465) ECR
Plugin now it is compatible with credential stored into folders
- [JENKINS-36127](https://issues.jenkins-ci.org/browse/JENKINS-36127) Resolved
a NPE when attempt to configure docker build and publish
- [JENKINS-34958](https://issues.jenkins-ci.org/browse/JENKINS-34958) New
credential format that contains the region. For example, by specifying the
following credentials: ecr:us-west-2:credential-id, the provider will set the
Region of the AWS Client to us-west-2, when requesting for Authorisation
token.

## 1.3 (2016-06-06)

- 1.2 Release failed to upload the artifact - so just release again to
correctly upload the artifact.

NOTE: This release doesn't contain any update.

## 1.2 (2016-06-03)

- Update parent pom

## 1.1 (2016-05-30)

- [JENKINS-35220](http://localhost:8085/display/JENKINS/Amazon+ECR#)
Correctly display the credentials

## 1.0 (2016-01-12)

- Replace custom ECR API client with aws-java-sdk

## 1.0-beta-1 (2015-12-22)

- Initial release
68 changes: 64 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,67 @@
## Amazon ECR Plugin
# Amazon ECR Plugin

This plugin offers integration with [Amazon ECR](https://aws.amazon.com/ecr/) (Docker registry) as a [DockerRegistryToken](https://github.com/jenkinsci/docker-commons-plugin/blob/master/src/main/java/org/jenkinsci/plugins/docker/commons/credentials/DockerRegistryToken.java) source to convert AWS Credentials into a Docker CLI Authentication Token.
This plugin offers integration with [Amazon Container Registry
(ECR)](https://aws.amazon.com/ecr/) as a [DockerRegistryToken] source to convert
Amazon Credentials into a Docker CLI Authentication Token.

It uses ECR [http://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_GetAuthorizationToken.html](GetAuthorizationToken) API to generate such a token.
[DockerRegistryToken]: https://github.com/jenkinsci/docker-commons-plugin/blob/master/src/main/java/org/jenkinsci/plugins/docker/commons/credentials/DockerRegistryToken.java

## About

Amazon ECR plugin implements a Docker Token producer to convert Amazon
credentials to Jenkins’ API used by (mostly) all Docker-related plugins.

Thank's to this producer, you can select your existing registered Amazon
credentials for various Docker operations in Jenkins, for sample using the
Docker Build and Publish plugin:

![](.github/build-and-publish.png)

## Installation

Navigate to the "Plugin Manager" screen, install the "Amazon ECR" plugin and
restart Jenkins.

The plugin will use the proxy configured on Jenkins if it is set.

Recommended logger for troubleshooting, you have to take care where you publish
these logs could contain sensitive information

- com.cloudbees.jenkins.plugins.amazonecr
- com.amazonaws
- org.apache.http.wire
- org.jenkinsci.plugins.docker.workflow

## Docker Pipeline Usage

When using the [Docker Pipeline
Plugin](https://plugins.jenkins.io/docker-workflow/), in order to obtain an ECR
login credential, you must use the ecr provider prefix.

```groovy
docker.withRegistry("https://your.ecr.domain.amazonws.com", "ecr:us-east-1:credential-id") {
docker.image("your-image-name").push()
}
```

If you experience authentication issues, you would try to remove user
docker configuration files on the agents before to run the docker
commands, something like this pipeline script.

```groovy
node {
// cleanup current user docker credentials
sh 'rm -f ~/.dockercfg ~/.docker/config.json || true'

// configure registry
docker.withRegistry('https://ID.ecr.eu-west-1.amazonaws.com', 'ecr:eu-west-1:86c8f5ec-1ce1-4e94-80c2-18e23bbd724a') {

// build image
def customImage = docker.build("my-image:${env.BUILD_ID}")

// push image
customImage.push()
}
}
```

See [wiki page](https://wiki.jenkins-ci.org/display/JENKINS/Amazon+ECR) for details
88 changes: 42 additions & 46 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,39 @@
~
-->

<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">
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.21</version>
<version>4.28</version>
</parent>

<groupId>com.cloudbees.jenkins.plugins</groupId>
<artifactId>amazon-ecr</artifactId>
<version>1.7-SNAPSHOT</version>
<version>${revision}${changelist}</version>
<packaging>hpi</packaging>

<name>Amazon ECR plugin</name>
<description>Integrate Jenkins with Amazon EC2 Container Registry (ECR)</description>
<url>https://plugins.jenkins.io/amazon-ecr</url>

<properties>
<jenkins.version>2.32.1</jenkins.version>
<java.level>7</java.level>
<powermock.version>1.6.1</powermock.version>
</properties>
<url>https://github.com/jenkinsci/amazon-ecr-plugin</url>
<licenses>
<license>
<name>MIT License</name>
<url>http://opensource.org/licenses/MIT</url>
</license>
</licenses>

<developers>
<developer>
<id>TobiX</id>
<name>Tobias Gruetzmacher</name>
<email>[email protected]</email>
<roles>
<role>Maintainer</role>
</roles>
</developer>
<developer>
<id>ndeloof</id>
<name>Nicolas De Loof</name>
Expand All @@ -66,43 +74,19 @@
</developers>

<scm>
<connection>scm:git:git://github.com/jenkinsci/amazon-ecr-plugin.git</connection>
<developerConnection>scm:git:[email protected]:jenkinsci/amazon-ecr-plugin.git</developerConnection>
<url>https://github.com/jenkinsci/amazon-ecr-plugin</url>
<tag>HEAD</tag>
<connection>scm:git:ssh://github.com/${gitHubRepo}.git</connection>
<developerConnection>scm:git:ssh://[email protected]/${gitHubRepo}.git</developerConnection>
<url>https://github.com/${gitHubRepo}</url>
<tag>${scmTag}</tag>
</scm>

<licenses>
<license>
<name>MIT License</name>
<url>http://opensource.org/licenses/MIT</url>
</license>
</licenses>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<configuration>
<excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
</configuration>
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
<properties>
<revision>1.7</revision>
<changelist>-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/amazon-ecr-plugin</gitHubRepo>
<jenkins.version>2.249.1</jenkins.version>
<java.level>8</java.level>
</properties>

<dependencies>
<dependency>
Expand All @@ -113,7 +97,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.11.119</version>
<version>1.11.341</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand All @@ -127,4 +111,16 @@
</dependency>
</dependencies>

<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
</project>
33 changes: 0 additions & 33 deletions src/findbugs/excludesFilter.xml

This file was deleted.