-
Notifications
You must be signed in to change notification settings - Fork 0
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
skarpenko
committed
Jan 16, 2024
1 parent
e9c83b0
commit 95f6636
Showing
58 changed files
with
4,322 additions
and
1 deletion.
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,22 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "maven" | ||
directory: "/" | ||
target-branch: "develop" | ||
schedule: | ||
interval: "weekly" | ||
open-pull-requests-limit: 50 | ||
ignore: | ||
- dependency-name: "com.amazonaws:*" | ||
update-types: ["version-update:semver-patch"] | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
target-branch: "develop" | ||
labels: | ||
- "housekeeping" | ||
schedule: | ||
interval: "monthly" | ||
- package-ecosystem: "docker" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
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,2 @@ | ||
"documentation": | ||
- /**/*.adoc |
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,34 @@ | ||
name-template: $NEXT_PATCH_VERSION | ||
tag-template: $NEXT_PATCH_VERSION | ||
|
||
template: | | ||
# Changes | ||
$CHANGES | ||
# -------- | ||
# NOTE: When adding new labels please also update required-labels.yml workflow. | ||
# -------- | ||
categories: | ||
- title: 💣️ Breaking changes | ||
label: breaking-change | ||
|
||
- title: 🚀 Features & Enhancements | ||
labels: | ||
- feature | ||
- enhancement | ||
|
||
- title: 🐞 Fixes | ||
label: bug | ||
|
||
- title: 📁 Java Dependencies updates | ||
label: dependencies | ||
|
||
- title: 📁 Docker images updates | ||
label: docker-update-images | ||
|
||
- title: 📖 Documentation | ||
label: documentation | ||
|
||
- title: 🏡 Housekeeping | ||
label: housekeeping | ||
|
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,14 @@ | ||
name: Changelog Release Drafter | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
update_release_draft: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: release-drafter/release-drafter@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,27 @@ | ||
name: "Trivy" | ||
|
||
on: | ||
schedule: | ||
- cron: '24 10 * * 5' | ||
|
||
jobs: | ||
build: | ||
name: Trivy vulnerability scanner | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Run Trivy vulnerability scanner in repo mode | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
scan-type: 'fs' | ||
ignore-unfixed: true | ||
format: 'sarif' | ||
output: 'trivy-results.sarif' | ||
severity: 'CRITICAL' | ||
|
||
- name: Upload Trivy scan results to GitHub Security tab | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: 'trivy-results.sarif' |
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,14 @@ | ||
name: "Pull Request Auto Labeler" | ||
on: | ||
- pull_request_target | ||
|
||
jobs: | ||
triage: | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/labeler@v4 | ||
with: | ||
repo-token: "${{ secrets.GITHUB_TOKEN }}" |
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,39 @@ | ||
# This workflow will build a Java project with Maven | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | ||
|
||
name: Java CI with Maven | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
pull_request: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
build-jdk17: | ||
runs-on: ubuntu-latest | ||
name: Build project | ||
concurrency: | ||
# The commit SHA or the branch name of the pull request. See: https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions | ||
group: ${{ github.event_name == 'pull_request' && github.head_ref || github.sha}} | ||
cancel-in-progress: true | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Cache Maven packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2 | ||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-m2 | ||
- name: Set up JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'corretto' | ||
- name: Build with Maven | ||
run: ./mvnw -version && whoami && umask -S && umask a+rw && umask -S && ./mvnw clean verify -P docker-clean -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.count=3 --no-snapshot-updates --batch-mode --no-transfer-progress |
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,47 @@ | ||
name: Publish to the Maven Central Repository | ||
|
||
on: | ||
release: | ||
types: [ published ] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{github.event.release.target_commitish}} | ||
token: ${{ secrets.RELEASE_PERSONAL_ACCESS_TOKEN }} | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'corretto' | ||
server-id: ossrh | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_PASSWORD | ||
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
gpg-passphrase: MAVEN_GPG_PASSPHRASE | ||
cache: 'maven' | ||
|
||
- name: Update version | ||
if: ${{ success() }} | ||
run: ./mvnw --batch-mode --no-transfer-progress versions:set -DnewVersion=${{github.event.release.tag_name}} versions:commit | ||
|
||
- name: Publish to the Maven Central Repository | ||
if: ${{ success() }} | ||
run: ./mvnw --batch-mode --no-transfer-progress -Dgib.disable=true -P ossrh -DskipTests deploy | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | ||
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
|
||
- name: Commit & Push changes | ||
if: ${{ success() }} | ||
uses: actions-js/push@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
message: 'Release ${{github.event.release.tag_name}}' | ||
branch: ${{ github.event.release.target_commitish }} |
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,39 @@ | ||
name: Renovate for update docker images | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
dryRun: | ||
description: "Dry-Run" | ||
default: false | ||
required: false | ||
type: boolean | ||
logLevel: | ||
description: "Log-Level" | ||
required: false | ||
default: 'debug' | ||
type: choice | ||
options: | ||
- info | ||
- warn | ||
- debug | ||
- error | ||
- fatal | ||
schedule: | ||
- cron: '0 8 * * *' | ||
|
||
jobs: | ||
renovate: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Self-hosted Renovate | ||
uses: renovatebot/github-action@v39.1.1 | ||
with: | ||
configurationFile: .github/renovate/renovate.json | ||
token: ${{ secrets.RELEASE_PERSONAL_ACCESS_TOKEN }} | ||
env: | ||
DRY_RUN: ${{ inputs.dryRun || 'false' }} | ||
LOG_LEVEL: ${{ inputs.logLevel || 'debug' }} |
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,16 @@ | ||
# https://github.com/mheap/github-action-required-labels | ||
name: Pull Request Required Labels | ||
on: | ||
pull_request: | ||
types: [ opened, labeled, unlabeled, synchronize ] | ||
jobs: | ||
label: | ||
if: github.event.pull_request.state == 'open' | ||
runs-on: ubuntu-latest | ||
name: Verify Pull Request has labels | ||
steps: | ||
- uses: mheap/github-action-required-labels@v5 | ||
with: | ||
mode: minimum | ||
count: 1 | ||
labels: "breaking-change, feature, enhancement, bug, dependencies, documentation, housekeeping" |
Binary file not shown.
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,18 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip | ||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# global-balancer | ||
# shepherd | ||
Allows to balance objects in distributed environment |
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,15 @@ | ||
<?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/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>shepherd-parent</artifactId> | ||
<groupId>com.playtika.shepherd</groupId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>common</artifactId> | ||
|
||
|
||
</project> |
29 changes: 29 additions & 0 deletions
29
common/src/main/java/com/playtika/shepherd/common/Farm.java
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,29 @@ | ||
package com.playtika.shepherd.common; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
/** | ||
* Farm has many herds distributed evenly by pastures | ||
*/ | ||
public interface Farm { | ||
|
||
/** | ||
* Here we come to Farm with our Pasture to graze specific Herd on it. | ||
* | ||
* @param herdName Herd we want to inhabit this pasture | ||
* @param pastureListener Will listen for animals from Herd that will be assigned to our Pasture | ||
* @return Shepherd allows to set Herd population | ||
*/ | ||
Pasture<ByteBuffer> addPasture(String herdName, PastureListener<ByteBuffer> pastureListener); | ||
|
||
/** | ||
* Here we come to Farm with our Pasture to graze specific Breeding Herd on it. | ||
* | ||
* @param herdName Herd we want to inhabit this pasture | ||
* @param breedClass Only elements of this class accepted in this herd | ||
* @param pastureListener Will listen for animals from Herd that will be assigned to our Pasture | ||
* @return Shepherd allows to set Herd population | ||
*/ | ||
<Breed> Pasture<Breed> addBreedingPasture(String herdName, Class<Breed> breedClass, PastureListener<Breed> pastureListener); | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
common/src/main/java/com/playtika/shepherd/common/Pasture.java
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,10 @@ | ||
package com.playtika.shepherd.common; | ||
|
||
import java.time.Duration; | ||
|
||
public interface Pasture<Breed> { | ||
|
||
Shepherd<Breed> getShepherd(); | ||
|
||
void close(Duration timeout); | ||
} |
12 changes: 12 additions & 0 deletions
12
common/src/main/java/com/playtika/shepherd/common/PastureListener.java
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,12 @@ | ||
package com.playtika.shepherd.common; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Invoked when new subpopulation assigned to this pasture | ||
*/ | ||
public interface PastureListener<Breed> { | ||
|
||
void assigned(List<Breed> population, int version, int generation, boolean isLeader); | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
common/src/main/java/com/playtika/shepherd/common/Shepherd.java
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,11 @@ | ||
package com.playtika.shepherd.common; | ||
|
||
/** | ||
* Allows to set herd population | ||
* @param <Breed> | ||
*/ | ||
public interface Shepherd<Breed> { | ||
|
||
void setPopulation(Breed[] population, int version); | ||
|
||
} |
Oops, something went wrong.