Skip to content
This repository has been archived by the owner on Apr 26, 2023. It is now read-only.

Commit

Permalink
Merge pull request #32 from cnescatlab/dev
Browse files Browse the repository at this point in the history
Version 1.1.0
  • Loading branch information
Sancretor authored Sep 23, 2021
2 parents b221857 + 58f45b8 commit 2be5611
Show file tree
Hide file tree
Showing 265 changed files with 3,476 additions and 228 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/close-milestone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Description
# ===========
# This workflow is triggered each time the Java CI workflow succeeds
# on master.
# It looks for a milestone that is completed and close it.
---
name: Close Milestone

on:
workflow_run:
workflows: ["Java CI"]
branches: [master]
types:
- completed

jobs:
close:
name: Close completed milestone
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Close a milestone if completed
run: |
milestones=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/milestones \
| jq -r '. | map(select(.open_issues == 0 and .closed_issues > 0 and .state == "open"))')
if [ "$milestones" != "[]" ]
then
milestone_number=$(echo "$milestones" | jq -r '.[0].number')
curl -s \
-X PATCH \
-H "Authorization: token ${GITHUB_TOKEN}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/milestones/${milestone_number} \
-d '{"state":"closed"}'
fi
env:
# Personal access tokens should be generated from https://github.com/settings/tokens with repository scope
GITHUB_TOKEN: ${{ secrets.REPO_SCOPED_TOKEN }}
57 changes: 57 additions & 0 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Description
# ===========
# This workflow is triggered each time a milestone is closed
# It builds the jar, generates release notes, pushes a new tag
# and makes a draft release with these elements.
---
name: Draft Release

on:
milestone:
types: [closed]

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Setup java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven
run: mvn -B clean package
- name: Create Release Notes
uses: docker://decathlon/release-notes-generator-action:2.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OUTPUT_FOLDER: temp_release_notes
- name: Set tag and project values
run: |
echo "tag=$(cat pom.xml | grep "<version>.*</version>" | head -1 |awk -F'[><]' '{print $3}')" >> $GITHUB_ENV
echo "project=$(echo ${{ github.repository }} | awk -F '/' '{print $2}')" >> $GITHUB_ENV
- name: Create a tag for the release
run: |
git config --global user.name "GitHub Actions"
git config --global user.email catlab@cnes.fr
git tag -a ${{ env.tag }} -m "Release ${{ env.tag }}"
git push origin ${{ env.tag }}
- name: Create GitHub Release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
artifacts: "target/${{ env.project }}-${{ env.tag }}.jar"
tag: ${{ env.tag }}
name: ${{ env.project }} ${{ env.tag }}
bodyFile: "temp_release_notes/release_file.md"
draft: true
token: ${{ secrets.GITHUB_TOKEN }}
72 changes: 72 additions & 0 deletions .github/workflows/java-continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Description
# ===========
# This workflow is triggered each time
# commits are pushed to GitHub or a pull request is opened.
# It launches two jobs in parallel : a build with java 11
# and a SonarCloud analysis.
---
name: Java CI

on: [push, pull_request]

env:
SONARQUBE_VERSION: 8.9.1-community

jobs:

build:
runs-on: ubuntu-latest
name: Java 11 CI
steps:
- name: Check out repository code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven
run: mvn -B clean package

code-analysis:
runs-on: ubuntu-latest
name: SonarCloud Code Analysis
# It's not possible to launch an analysis on external pull requests
if: ${{ github.repository_owner == 'cnescatlab' }}
steps:
- name: Check out repository code
uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Setup java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Cache SonarCloud packages
uses: actions/cache@v2
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Build and analyze
env:
# Needed to get some information about the pull request, if any
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SonarCloud access token should be generated from https://sonarcloud.io/account/security/
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.organization=lequal -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN
40 changes: 0 additions & 40 deletions .travis.yml

This file was deleted.

7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ Go to the project page to find indications : https://github.com/hadolint/hadolin
#### Plugin's properties
- `sonar.lang.patterns.dockerfile`:
- Comma separated list of patterns matching Dockerfiles inside your project.
- This property **MUST** be defined if you want the plugin to work.
- **/!\\** _Those patterns must match Dockerfiles only ! You will have issues if they match another analyzed language._
- Default: `Dockerfile`.
- Example: `**/Dockerfile,subdir/Dockerfile-example`
- `sonar.hadolint.reports.path`:
- Comma separated list of path to Hadolint reports in checkstyle format.
- Comma separated list of path to Hadolint reports in checkstyle format. You can use wildcards.
- Default: `hadolint-report.xml`.
- Example : `**/hadolint-report.xml`

These properties can be defined in a `sonar-project.properties` files, or as command line arguments when you start the Sonar Scanner :
`sonar-scanner -Dsonar.lang.patterns.dockerfile=Dockerfile,some-dir/Dockerfile.* -Dsonar.hadolint.reports.path=results/report.xml`
Expand All @@ -67,6 +69,7 @@ These properties can be defined in a `sonar-project.properties` files, or as com
| plugin version | hadolint version | supported SonarQube version |
|:------------------:|:-----------------------:|:---------------------------:|
| 1.0.0 | 1.18.x | 7.9 -> 8.4 |
| 1.1.0 | 2.6.1 | 8.9.x |

### Building the plugin
If you want to build the plugin :
Expand Down
37 changes: 24 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>fr.cnes.sonarqube.plugins</groupId>
<artifactId>sonar-hadolint-plugin</artifactId>
<packaging>sonar-plugin</packaging>
<version>1.0.0</version>
<version>1.1.0</version>
<name>SonarQube Hadolint Plugin</name>

<description>Hadolint plugin for SonarQube</description>
Expand Down Expand Up @@ -38,10 +38,10 @@
<properties>
<jdk.version>1.8</jdk.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.apiVersion>7.9.3</sonar.apiVersion>
<sonar.apiVersion>8.9.1.44547</sonar.apiVersion>
<slf4j.version>1.7.25</slf4j.version>
<junit.version>4.12</junit.version>
<jacoco.version>0.8.4</jacoco.version>
<junit.version>4.13.2</junit.version>
<jacoco.version>0.8.7</jacoco.version>
<project.key>hadolint</project.key>
<sonar.pluginKey>sonar-hadolint-plugin</sonar.pluginKey>
<sonar.pluginClass>fr.cnes.sonar.plugins.hadolint.HadolintPlugin</sonar.pluginClass>
Expand All @@ -59,15 +59,20 @@
<version>${sonar.apiVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
<artifactId>sonar-plugin-api-impl</artifactId>
<version>${sonar.apiVersion}</version>
</dependency>
<dependency>
<groupId>org.sonarsource.analyzer-commons</groupId>
<artifactId>sonar-analyzer-commons</artifactId>
<version>1.11.0.541</version>
<version>1.15.0.699</version>
</dependency>
<dependency>
<groupId>org.sonarsource.sslr</groupId>
<artifactId>sslr-core</artifactId>
<version>1.23</version>
<version>1.24.0.633</version>
</dependency>
<dependency>
<!-- packaged with the plugin -->
Expand All @@ -92,12 +97,18 @@
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
<version>2.28.2</version>
<version>3.11.2</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.11.1</version>
<version>1.4.17</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.20.2</version>
<scope>test</scope>
</dependency>
</dependencies>

Expand Down Expand Up @@ -139,7 +150,7 @@
<plugin>
<groupId>org.sonarsource.sonar-packaging-maven-plugin</groupId>
<artifactId>sonar-packaging-maven-plugin</artifactId>
<version>1.17</version>
<version>1.20.0.405</version>
<extensions>true</extensions>
<configuration>
<pluginClass>fr.cnes.sonar.plugins.hadolint.HadolintPlugin</pluginClass>
Expand All @@ -151,7 +162,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<version>3.8.1</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
Expand All @@ -175,20 +186,20 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.9</version>
<version>3.1.2</version>
<configuration>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M4</version>
<version>3.0.0-M5</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>3.0.0-M4</version>
<version>3.0.0-M5</version>
</dependency>
</dependencies>
</plugin>
Expand Down
Loading

0 comments on commit 2be5611

Please sign in to comment.