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

Improve the APIs in the LDAP package #45

Merged
merged 60 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
be0db58
Initial commit
Nuvindu May 31, 2024
d20bf11
[Automated] Update the toml files
Nuvindu May 31, 2024
8e84279
Initiate a Gradle project
Nuvindu May 31, 2024
3d84123
Add necessary Gradle build files
Nuvindu May 31, 2024
bd21941
Add native APIs for the package
Nuvindu May 31, 2024
8a8a03e
Add Ballerina.toml
Nuvindu May 31, 2024
1356b45
Add client APIs for the ldap package
Nuvindu May 31, 2024
33a6d16
Add github workflow files
Nuvindu May 31, 2024
80823c6
Add code owners
Nuvindu May 31, 2024
e7f12b9
Add README.md
Nuvindu May 31, 2024
d1f35d0
Add Config.toml to .gitignore
Nuvindu May 31, 2024
aa1d577
Add test cases to validate initial LDAP API
Nuvindu May 31, 2024
71743d6
Add API docs
Nuvindu Jun 3, 2024
2d0bad4
Add github workflow files for library modules
Nuvindu Jun 3, 2024
1d16488
Fix typos having incorrect module names
Nuvindu Jun 3, 2024
514605f
Add missing gradle-wrapper.jar
Nuvindu Jun 3, 2024
8f44c58
Add documentation to the package
Nuvindu Jun 3, 2024
9ed07e5
Apply suggestions from the review
Nuvindu Jun 3, 2024
58b1642
[Automated] Update the toml files
Nuvindu Jun 3, 2024
63c1698
[Automated] Update the toml files
Nuvindu Jun 3, 2024
450af35
Add doc comments to native classes
Nuvindu Jun 3, 2024
d40143c
Add module specific error type
Nuvindu Jun 3, 2024
10bbae3
Update the overview in docs
Nuvindu Jun 3, 2024
9773db2
Add docs for public record types
Nuvindu Jun 3, 2024
1a937b8
Fix error handling in the APIs
Nuvindu Jun 4, 2024
22a19af
Add test cases to validate error handling
Nuvindu Jun 4, 2024
57953d8
Ignore null values when updating entries
Nuvindu Jun 4, 2024
3d03a35
Add test cases to validate update API
Nuvindu Jun 4, 2024
78d6227
Fix receiving attribute values from entries
Nuvindu Jun 4, 2024
1ea0d52
Fix getting unreadable strings for objectGUID and objectSid
Nuvindu Jun 4, 2024
47cc9cd
Remove additional empty line
Nuvindu Jun 4, 2024
709e0d3
Add error record type to describe errors
Nuvindu Jun 4, 2024
a2cb17c
Remove unnecessary external library versions
Nuvindu Jun 4, 2024
fbe1135
Merge pull request #1 from Nuvindu/initial-version
Nuvindu Jun 4, 2024
4bb74a8
Fix example code in docs
Nuvindu Jun 4, 2024
0c154a2
Merge remote-tracking branch 'source/main' into revamped
Nuvindu Jun 4, 2024
8bd66b1
Include add, delete APIs for LDAP
Nuvindu Jun 5, 2024
5e72527
Update docs for new APIs
Nuvindu Jun 5, 2024
398c3ca
Add error details record type for the error type
Nuvindu Jun 5, 2024
9559eb4
Add default object class record types for LDAP
Nuvindu Jun 5, 2024
ff9aabc
Add test cases for add, delete APIs
Nuvindu Jun 5, 2024
a5ebc30
Exclude test cases in pull request build
Nuvindu Jun 5, 2024
c3b1065
Add mock values to Config.toml
Nuvindu Jun 5, 2024
0548d07
Exclude tests in pull request workflow build
Nuvindu Jun 5, 2024
4402185
[Automated] Update the toml files
Nuvindu Jun 5, 2024
31c3a85
Add variables for dependency versions in Ballerina.toml
Nuvindu Jun 5, 2024
2a31fb6
Add LF format for java EOF
Nuvindu Jun 5, 2024
6068e4a
Remove Config.toml
Nuvindu Jun 5, 2024
0578573
Improve native methods in LDAP
Nuvindu Jun 7, 2024
b72e78f
Add new test cases to validate new APIs
Nuvindu Jun 7, 2024
65e94b5
Update documentation with new APIs
Nuvindu Jun 7, 2024
2653036
Add badges and instructions in README.md
Nuvindu Jun 7, 2024
fe604db
Fix typos in docs
Nuvindu Jun 7, 2024
1df541f
Move utility functions to a separate class
Nuvindu Jun 10, 2024
8db7d95
Update package version to 0.8.0
Nuvindu Jun 10, 2024
37aaf59
Update `LdapResponse` record name
Nuvindu Jun 10, 2024
cdde708
Apply suggestions from the review
Nuvindu Jun 10, 2024
1dac65f
Fix errors when adding entries with null values
Nuvindu Jun 10, 2024
2d44b8f
[Automated] Update the toml files
Nuvindu Jun 10, 2024
e761f98
Fix an API in a test case
Nuvindu Jun 10, 2024
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
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
Nuvindu marked this conversation as resolved.
Show resolved Hide resolved
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

# Ensure all Java files use LF.
*.java eol=lf
7 changes: 7 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners.

# See: https://help.github.com/articles/about-codeowners/

# These owners will be the default owners for everything in the repo.
* @Nuvindu
19 changes: 19 additions & 0 deletions .github/workflows/build-timestamped-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Build

on:
push:
branches:
- main
paths-ignore:
- '*.md'
- 'docs/**'
- 'load-tests/**'

workflow_dispatch:

jobs:
call_workflow:
name: Run Build Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/build-timestamp-master-template.yml@main
secrets: inherit
37 changes: 37 additions & 0 deletions .github/workflows/build-with-bal-test-graalvm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: GraalVM Check

on:
workflow_dispatch:
inputs:
lang_tag:
description: Branch/Release Tag of the Ballerina Lang
required: true
default: main
lang_version:
description: Ballerina Lang Version (If given ballerina lang build will be skipped)
required: false
default: ''
native_image_options:
description: Default native-image options
required: false
default: ''
schedule:
- cron: '30 18 * * *'
pull_request:
branches:
- main
types: [ opened, synchronize, reopened, labeled, unlabeled ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
call_stdlib_workflow:
name: Run StdLib Workflow
if: ${{ github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'ballerina-platform') }}
uses: ballerina-platform/ballerina-library/.github/workflows/build-with-bal-test-graalvm-template.yml@main
with:
lang_tag: ${{ inputs.lang_tag }}
lang_version: ${{ inputs.lang_version }}
native_image_options: '-J-Xmx7G ${{ inputs.native_image_options }}'
21 changes: 21 additions & 0 deletions .github/workflows/central-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Publish to the Ballerina central

on:
workflow_dispatch:
inputs:
environment:
type: choice
description: Select Environment
required: true
options:
- DEV CENTRAL
- STAGE CENTRAL

jobs:
call_workflow:
name: Run Central Publish Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/central-publish-template.yml@main
secrets: inherit
with:
environment: ${{ github.event.inputs.environment }}
16 changes: 16 additions & 0 deletions .github/workflows/fossa_scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Fossa Scan
on:
workflow_dispatch:
schedule:
- cron: '30 18 * * *' # 00:00 in LK time (GMT+5:30)
jobs:
fossa-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: fossas/fossa-action@main
env:
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
with:
api-key: ${{secrets.FOSSA_APIKEY}}
65 changes: 11 additions & 54 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,16 @@
name: Publish release
name: Publish Release

on:
workflow_dispatch:
repository_dispatch:
types: [stdlib-release-pipeline]
workflow_dispatch:
repository_dispatch:
types: [ stdlib-release-pipeline ]

jobs:
publish-release:
runs-on: ubuntu-latest
if: github.repository_owner == 'ballerina-platform'

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
call_workflow:
name: Run Release Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/release-package-template.yml@main
secrets: inherit
with:
java-version: 11
- name: Set version env variable
run: echo "VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | cut -d- -f1)" >> $GITHUB_ENV
- name: Pre release depenency version update
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
echo "Version: ${VERSION}"
git config user.name ${{ secrets.BALLERINA_BOT_USERNAME }}
git config user.email ${{ secrets.BALLERINA_BOT_EMAIL }}
git checkout -b release-${VERSION}
sed -i 's/ballerinaLangVersion=\(.*\)-SNAPSHOT/ballerinaLangVersion=\1/g' gradle.properties
sed -i 's/stdlib\(.*\)=\(.*\)-SNAPSHOT/stdlib\1=\2/g' gradle.properties
git add gradle.properties
git commit -m "Move dependencies to stable version" || echo "No changes to commit"
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Publish artifact
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_ACCESS_TOKEN }}
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
./gradlew release -Prelease.useAutomaticVersion=true
./gradlew -Pversion=${VERSION} publish -x test
- name: Create Github release from the release tag
run: |
curl --request POST 'https://api.github.com/repos/ballerina-platform/module-ballerina-ldap/releases' \
--header 'Accept: application/vnd.github.v3+json' \
--header 'Authorization: Bearer ${{ secrets.BALLERINA_BOT_TOKEN }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"tag_name": "v'"$VERSION"'",
"name": "module-ballerina-ldap-v'"$VERSION"'"
}'
- name: Post release PR
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
bin/hub pull-request -m "[Automated] Sync master after "$VERSION" release"
package-name: ldap
package-org: ballerina
47 changes: 15 additions & 32 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,19 @@
name: PR build
name: Pull Request

on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
ubuntu-build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew build
on: pull_request

windows-build:

runs-on: windows-latest

steps:
- uses: actions/checkout@v1
- name: Set up JDK 11
uses: actions/setup-java@v1
jobs:
call_workflow:
name: Run PR Build Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/pull-request-build-template.yml@main
secrets: inherit
with:
java-version: 11
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew.bat build
additional-ubuntu-build-flags: "-x test"
additional-ubuntu-test-flags: "-x test"
additional-windows-build-flags: "-x test"
additional-windows-test-flags: "-x test"
19 changes: 19 additions & 0 deletions .github/workflows/stale_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'Close stale pull requests'

on:
schedule:
- cron: '30 19 * * *'
workflow_dispatch:

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
with:
stale-pr-message: 'This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the `stale` label is removed or commented.'
close-pr-message: 'Closed PR due to inactivity for more than 18 days.'
days-before-pr-stale: 15
days-before-pr-close: 3
days-before-issue-stale: -1
days-before-issue-close: -1
13 changes: 13 additions & 0 deletions .github/workflows/trivy-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Trivy

on:
workflow_dispatch:
schedule:
- cron: "30 20 * * *"

jobs:
call_workflow:
name: Run Trivy Scan Workflow
if: ${{ github.repository_owner == 'ballerina-platform' }}
uses: ballerina-platform/ballerina-library/.github/workflows/trivy-scan-template.yml@main
secrets: inherit
48 changes: 48 additions & 0 deletions .github/workflows/update-spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Update Specifications

env:
SPEC_FOLDER_PATH: 'docs/spec'

on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'docs/spec/**'

jobs:
update_specs:
name: Update Specifications
if: github.repository_owner == 'ballerina-platform'
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"

- name: Get Repo Name
id: repo_name
run: |
MODULE=${{ github.event.repository.name }}
echo "::set-output name=short_name::${MODULE##*-}"

- name: Trigger Workflow
run: |
curl --request POST \
'https://api.github.com/repos/ballerina-platform/ballerina-dev-website/dispatches' \
-H 'Accept: application/vnd.github.v3+json' \
-H 'Authorization: Bearer ${{ secrets.BALLERINA_BOT_TOKEN }}' \
--data "{
\"event_type\": \"update-stdlib-specs\",
\"client_payload\": {
\"module_name\": \"${{ github.event.repository.name }}\",
\"short_name\": \"${{ steps.repo_name.outputs.short_name }}\",
\"file_dir\": \"${{ github.event.repository.name }}/${{ env.SPEC_FOLDER_PATH }}\",
\"release_date\": \"${{ steps.date.outputs.date }}\"
}
}"
30 changes: 20 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
# Log file
*.log

# Lock file
*.lck

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
!gradle/wrapper/gradle-wrapper.jar
*.jar
*.war
*.nar
Expand All @@ -19,21 +23,27 @@
*.tar.gz
*.rar

# System files
.DS_Store

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

build
.gradle/
target
# IDEA Files
.idea/
*.iml
*.ipr
*.iws
# IDE-related files
.idea
.code
.project
.settings
.vscode

# MacOS
*.DS_Store
# Build Files
.gradle
target
build
bin

# Ballerina
velocity.log*
*Ballerina.lock
examples/**/Dependencies.toml
Config.toml
Loading
Loading