-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 30fb327
Showing
26 changed files
with
1,396 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Setup project | ||
description: Specific steps to checkout the project and setup the environment | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: 17 | ||
overwrite-settings: false # This will use our runner settings.xml for Maven | ||
|
||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
|
||
- name: Set up Cloud SDK | ||
uses: google-github-actions/setup-gcloud@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
publish: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout project | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: ./.github/actions/setup | ||
|
||
- name: Publishing gradle plugins | ||
env: | ||
GPG_KEY_ID: $GPG_KEY_ID | ||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | ||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
run: > | ||
./gradlew publishPlugins -Pgradle.publish.key=${{ secrets.GRADLE_PUBLISH_KEY }} -Pgradle.publish.secret=${{ secrets.GRADLE_PUBLISH_SECRET }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Primary | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
name: Build and test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout project | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: ./.github/actions/setup | ||
|
||
- name: Analyse code, build and test everything | ||
env: | ||
SERVICE_ACCOUNT_JSON: ${{ secrets.SERVICE_ACCOUNT_JSON }} | ||
run: ./gradlew build | ||
|
||
- name: Publish Unit Test Results | ||
uses: EnricoMi/publish-unit-test-result-action@v2 | ||
if: always() | ||
with: | ||
junit_files: "**/build/test-results/**/*.xml" | ||
publish: | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/main' | ||
needs: | ||
- build | ||
steps: | ||
- name: Checkout project | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: ./.github/actions/setup | ||
|
||
- name: Publishing gradle plugins | ||
env: | ||
GPG_KEY_ID: ${{ vars.GPG_KEY_ID }} | ||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | ||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
run: > | ||
./gradlew publishPlugins -Pgradle.publish.key=${{ secrets.GRADLE_PUBLISH_KEY }} -Pgradle.publish.secret=${{ secrets.GRADLE_PUBLISH_SECRET }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.gradle | ||
**/build/ | ||
!src/**/build/ | ||
|
||
# Ignore Gradle GUI config | ||
gradle-app.setting | ||
|
||
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) | ||
!gradle-wrapper.jar | ||
|
||
# Avoid ignore Gradle wrappper properties | ||
!gradle-wrapper.properties | ||
|
||
# Cache of project | ||
.gradletasknamecache | ||
|
||
# Eclipse Gradle plugin generated files | ||
# Eclipse Core | ||
.project | ||
# JDT-specific (Eclipse Java Development Tools) | ||
.classpath | ||
local.properties | ||
.DS_Store | ||
.idea/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Code of Conduct | ||
|
||
## Our Pledge | ||
|
||
In the interest of fostering an open and welcoming environment, we as | ||
contributors and maintainers pledge to make participation in our project and | ||
our community a harassment-free experience for everyone, regardless of age, body | ||
size, disability, ethnicity, sex characteristics, gender identity and expression, | ||
level of experience, education, socio-economic status, nationality, personal | ||
appearance, race, religion, or sexual identity and orientation. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to creating a positive environment | ||
include: | ||
|
||
- Using welcoming and inclusive language | ||
- Being respectful of differing viewpoints and experiences | ||
- Gracefully accepting constructive criticism | ||
- Focusing on what is best for the community | ||
- Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
- The use of sexualized language or imagery and unwelcome sexual attention or | ||
advances | ||
- Trolling, insulting/derogatory comments, and personal or political attacks | ||
- Public or private harassment | ||
- Publishing others' private information, such as a physical or electronic | ||
address, without explicit permission | ||
- Other conduct which could reasonably be considered inappropriate in a | ||
professional setting | ||
|
||
## Our Responsibilities | ||
|
||
Project maintainers are responsible for clarifying the standards of acceptable | ||
behavior and are expected to take appropriate and fair corrective action in | ||
response to any instances of unacceptable behavior. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or | ||
reject comments, commits, code, wiki edits, issues, and other contributions | ||
that are not aligned to this Code of Conduct, or to ban temporarily or | ||
permanently any contributor for other behaviors that they deem inappropriate, | ||
threatening, offensive, or harmful. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies within all project spaces, and it also applies when | ||
an individual is representing the project or its community in public spaces. | ||
Examples of representing a project or community include using an official | ||
project e-mail address, posting via an official social media account, or acting | ||
as an appointed representative at an online or offline event. Representation of | ||
a project may be further defined and clarified by project maintainers. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be | ||
reported by contacting our team at <[email protected]>. All | ||
complaints will be reviewed and investigated and will result in a response that | ||
is deemed necessary and appropriate to the circumstances. The project team is | ||
obligated to maintain confidentiality with regard to the reporter of an incident. | ||
Further details of specific enforcement policies may be posted separately. | ||
|
||
Project maintainers who do not follow or enforce the Code of Conduct in good | ||
faith may face temporary or permanent repercussions as determined by other | ||
members of the project's leadership. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, | ||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html | ||
|
||
[homepage]: https://www.contributor-covenant.org | ||
|
||
For answers to common questions about this code of conduct, see | ||
https://www.contributor-covenant.org/faq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Contributing | ||
|
||
If you are on this page it means you are almost ready to contribute proposing changes, fixing issues | ||
or anything else about the Gar Cli plugin. So, thanks a lot for this!! ππ | ||
|
||
### Prerequisites | ||
|
||
* Skills with kotlin | ||
* Experience with the Gradle framework | ||
* A bookmark to | ||
the [official gcloud auth cli documentation](https://cloud.google.com/sdk/gcloud/reference/auth) | ||
|
||
### Plugin design | ||
|
||
The plugin uses this flow: | ||
|
||
* Search the `gcloud` executable path otherwise fails | ||
* Search for the logged user | ||
* If user is missing or if user's token is expired (or invalid) | ||
* If the current machine is a CI machine π FAILS | ||
* If not π executes `gcloud auth login` and resume the next step | ||
* If user is registered and token is valid | ||
* π Uses the token to authenticate to the remote GAR | ||
|
||
### Runtime environment | ||
|
||
The plugin is compatible with Linux/MacOS and Windows, this mean system specific commands | ||
like `which` for linux must be also translated to run upon the windows eco-system. To make it | ||
possible, always run commands by using the extension | ||
method `ExecSpec.commandLineMultiplatform(vararg args: Any)` and ask gradle for the current OS by | ||
calling `DefaultNativePlatform.getCurrentOperatingSystem()`. The returns object contains methods | ||
like `isWindows: Boolean`, `isMacOsX: Boolean` and `isLinux: Boolean`. | ||
|
||
### Gradle Value Sources | ||
|
||
This plugin mainly works with the `ValueSource` interface to fetch values from the current OS or | ||
from the CLI. Some type like `AuthenticateUser` implements `ValueSource` without returning any | ||
values. Most of the values sources uses `ExecOperations.exec {}` because most of them needs to | ||
run CLI commands. Because Gradle is written in JAVA, some types don't handle well Kotlin features, | ||
for instance, using `Provider<T>` with a null value is confusing, forcing you to declare a provider | ||
like this `Provider<Optional<T>>`. To get around this boilerplate, kotlin oriented extensions were | ||
added in the file `Tools.kt`. | ||
|
||
### Tests | ||
|
||
You can run test on your local machine or in your own CI, both are compatible. This repo uses a | ||
custom Decathlon runner to run CI builds, when forking this project, you have to adapt the workflow | ||
a little bit to make is compatible with `ubuntu-latest`. When test are run, Google Cloud | ||
Authentication authentication is required BUT the integrity of the token is not evaluated when | ||
connecting to the remote GAR. This choice was motivated by the need to keep private GAR urls | ||
privates and by the fact than check the integrity of the token is something outside of the scope of | ||
this plugin. The purpose of this plugin is to bind the local gcloud cli to gradle's declared | ||
repositories from your project. The content itself of the authentication data it up to the Google | ||
Cloud admin from your organisation. | ||
|
||
Running on a CI machine requires the `SERVICE_ACCOUNT_JSON` environment variable. |
Oops, something went wrong.