From f7a787485f03d667845dc09ceac524de8c999d65 Mon Sep 17 00:00:00 2001 From: Hugo Renard Date: Tue, 26 Nov 2024 18:12:53 +0100 Subject: [PATCH] ci: move to forgejo + nix + maven --- .forgejo/workflows/main.yml | 22 ++++++++ .gitignore | 4 +- .gitlab-ci.yml | 10 ---- auto.sh | 4 -- build.gradle | 28 ---------- docker-compose.yml | 2 +- flake.lock | 61 +++++++++++++++++++++ flake.nix | 44 +++++++++++++++ keycloak-scim.iml | 106 ------------------------------------ pom.xml | 85 +++++++++++++++++++++++++++++ 10 files changed, 216 insertions(+), 150 deletions(-) create mode 100644 .forgejo/workflows/main.yml delete mode 100644 .gitlab-ci.yml delete mode 100755 auto.sh delete mode 100644 build.gradle create mode 100644 flake.lock create mode 100644 flake.nix delete mode 100644 keycloak-scim.iml create mode 100644 pom.xml diff --git a/.forgejo/workflows/main.yml b/.forgejo/workflows/main.yml new file mode 100644 index 0000000000..761f38e700 --- /dev/null +++ b/.forgejo/workflows/main.yml @@ -0,0 +1,22 @@ +on: [push, tag] +jobs: + build: + runs-on: native + steps: + - uses: actions/checkout@v4 + - run: nix build .# --out-link keycloak-scim.jar + - uses: actions/upload-artifact@v3 + with: + path: keycloak-scim.jar + release: + runs-on: native + needs: [build] + if: github.ref_type == 'tag' + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v3 + - run: | + export XDG_CONFIG_HOME=$PWD/.config + export GITEA_SERVER_TOKEN=${{ secrets.GITHUB_TOKEN }} + tea login add --url ${{ env.GITHUB_SERVER_URL }} + tea release create --asset ./artifact/keycloak-scim.jar --note "$(git-cliff -s all --current)" --repo "${{ github.repository }}" --tag "${{ github.ref_name }}" --title "${{ github.ref_name }}" diff --git a/.gitignore b/.gitignore index 0a76f5bcc5..ad82e7e186 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ /build /bin /.idea -/.gradle \ No newline at end of file +/.gradle +/target +/result \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 99347f14d3..0000000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,10 +0,0 @@ -package: - image: - name: gradle:jdk17 - script: - - gradle jar shadowjar - artifacts: - paths: - - build/libs/keycloak-scim-1.0-SNAPSHOT.jar - - build/libs/keycloak-scim-1.0-SNAPSHOT-all.jar - - build/libs/keycloak-scim-1.0-SNAPSHOT-all-legacy.jar diff --git a/auto.sh b/auto.sh deleted file mode 100755 index 884ba67840..0000000000 --- a/auto.sh +++ /dev/null @@ -1,4 +0,0 @@ -gradle jar shadowjar -scp build/libs/keycloak-scim-1.0-SNAPSHOT-all.jar root@192.168.130.252:/var/www/html/keycloak-scim-1.0-SNAPSHOT-all.jar -scp build/libs/keycloak-scim-1.0-SNAPSHOT-all.jar root@192.168.130.252:/var/www/html/keycloak-scim-aws-1.0-SNAPSHOT-all.jar -k delete pod keycloak-keycloakx-0 -n keycloak diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 7897ff6a60..0000000000 --- a/build.gradle +++ /dev/null @@ -1,28 +0,0 @@ -plugins { - id 'java' - id 'com.github.johnrengelman.shadow' version '8.1.1' - id "org.sonarqube" version "5.1.0.4882" - id "com.github.ben-manes.versions" version "0.51.0" -} - -group = 'sh.libre.scim' -version = '1.0-SNAPSHOT' -description = 'keycloak-scim' - -java.sourceCompatibility = JavaVersion.VERSION_17 - -repositories { - mavenLocal() - mavenCentral() -} - -dependencies { - compileOnly 'org.keycloak:keycloak-core:26.0.1' - compileOnly 'org.keycloak:keycloak-server-spi:26.0.1' - compileOnly 'org.keycloak:keycloak-server-spi-private:26.0.1' - compileOnly 'org.keycloak:keycloak-services:26.0.1' - compileOnly 'org.keycloak:keycloak-model-jpa:26.0.1' - implementation 'io.github.resilience4j:resilience4j-retry:2.2.0' - implementation 'de.captaingoldfish:scim-sdk-common:1.26.0' - implementation 'de.captaingoldfish:scim-sdk-client:1.26.0' -} diff --git a/docker-compose.yml b/docker-compose.yml index 43e4f3a770..40777c2beb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,7 +15,7 @@ services: build: . command: start-dev volumes: - - ./build/libs/keycloak-scim-1.0-SNAPSHOT-all.jar:/opt/keycloak/providers/keycloak-scim-1.0-SNAPSHOT-all.jar + - ./result:/opt/keycloak/providers/keycloak-scim.jar environment: KC_DB: postgres KC_DB_URL_HOST: postgres diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000000..d432072b2e --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1726937504, + "narHash": "sha256-bvGoiQBvponpZh8ClUcmJ6QnsNKw0EMrCQJARK3bI1c=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9357f4f23713673f310988025d9dc261c20e70c6", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000000..acddbedcaa --- /dev/null +++ b/flake.nix @@ -0,0 +1,44 @@ +{ + description = "SCIM client Keycloak extension"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = + { + nixpkgs, + flake-utils, + ... + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + packages.default = pkgs.maven.buildMavenPackage rec { + pname = "keycloak-scim"; + version = "1.0-SNAPSHOT"; + src = ./.; + + mvnHash = "sha256-y3ASPCAbgwSJNu4NiBeWNFc8YA903C0e5z0/TSlc3Og="; + + installPhase = '' + cp target/${pname}-${version}-jar-with-dependencies.jar $out + ''; + + # meta = with lib; { + # description = "Simple command line wrapper around JD Core Java Decompiler project"; + # homepage = "https://github.com/intoolswetrust/jd-cli"; + # license = licenses.gpl3Plus; + # maintainers = with maintainers; [ majiir ]; + # }; + }; + devShells.default = pkgs.mkShell { + nativeBuildInputs = [ pkgs.maven ]; + }; + } + ); +} diff --git a/keycloak-scim.iml b/keycloak-scim.iml deleted file mode 100644 index 414103a5e4..0000000000 --- a/keycloak-scim.iml +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000..5fe4de6ef5 --- /dev/null +++ b/pom.xml @@ -0,0 +1,85 @@ + + 4.0.0 + + + 17 + 17 + + + sh.libre.scim + keycloak-scim + 1.0-SNAPSHOT + jar + + + + org.keycloak + keycloak-core + 26.0.1 + provided + + + org.keycloak + keycloak-server-spi + 26.0.1 + provided + + + org.keycloak + keycloak-server-spi-private + 26.0.1 + provided + + + org.keycloak + keycloak-services + 26.0.1 + provided + + + org.keycloak + keycloak-model-jpa + 26.0.1 + provided + + + io.github.resilience4j + resilience4j-retry + 2.2.0 + + + de.captaingoldfish + scim-sdk-common + 1.26.0 + + + de.captaingoldfish + scim-sdk-client + 1.26.0 + + + + + + + maven-assembly-plugin + 3.7.1 + + + package + + single + + + + + + jar-with-dependencies + + + + + + \ No newline at end of file