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

[Main] Update connector workflows with the changes required for Ballerina gradle plugin v3 #7449

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/apply-library-repo-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
token: ${{ secrets.BALLERINA_BOT_TOKEN }}

- name: Setup Ballerina
uses: ballerina-platform/[email protected].0
uses: ballerina-platform/[email protected].3
with:
version: latest

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-connector-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
echo "Ballerina Version: $BAL_VERSION"

- name: Set Up Ballerina
uses: ballerina-platform/[email protected].0
uses: ballerina-platform/[email protected].3
with:
version: ${{ env.BAL_VERSION }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
uses: actions/checkout@v3

- name: Set Up Ballerina
uses: ballerina-platform/[email protected].0
uses: ballerina-platform/[email protected].3
with:
version: latest
version: nightly

- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
Expand All @@ -45,7 +45,7 @@ jobs:
echo -e '${{ toJson(secrets) }}' | jq -r 'to_entries[] | .key + "=" + .value' >> $GITHUB_ENV

- name: Build Package
run: ./gradlew build ${{ inputs.additional-build-flags }}
run: ./gradlew build ${{ inputs.additional-build-flags }} -PignoreVersionMismatch
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/daily-build-connector-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:
uses: actions/checkout@v3

- name: Set Up Ballerina
uses: ballerina-platform/[email protected].0
uses: ballerina-platform/[email protected].3
with:
version: latest
version: nightly

- name: Set up JDK 21
uses: actions/setup-java@v3
Expand All @@ -46,14 +46,14 @@ jobs:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew build -x test ${{ inputs.additional-build-flags }} -PbuildUsingDocker=nightly
./gradlew build -x test ${{ inputs.additional-build-flags }} -PignoreVersionMismatch

- name: Test the Package
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew test ${{ inputs.additional-test-flags }} -PbuildUsingDocker=nightly
./gradlew test ${{ inputs.additional-test-flags }} -PignoreVersionMismatch

# Send notification when build fails
- name: Notify failure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
echo "Ballerina Version: $BAL_VERSION"

- name: Set Up Ballerina
uses: ballerina-platform/[email protected].0
uses: ballerina-platform/[email protected].3
with:
version: ${{ env.BAL_VERSION }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-build-connector-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
echo "Ballerina Version: $BAL_VERSION"

- name: Set Up Ballerina
uses: ballerina-platform/[email protected].0
uses: ballerina-platform/[email protected].3
with:
version: ${{ env.BAL_VERSION }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-package-connector-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
echo "Ballerina Version: $BAL_VERSION"

- name: Set Up Ballerina
uses: ballerina-platform/[email protected].0
uses: ballerina-platform/[email protected].3
with:
version: ${{ env.BAL_VERSION }}

Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/trivy-scan-connector-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Trivy

on:
workflow_call:
inputs:
additional-build-flags:
required: false
type: string
default: ""

jobs:
ubuntu-build:
name: Build on Ubuntu
runs-on: ubuntu-latest
if: github.repository_owner == 'ballerina-platform'
steps:
- uses: actions/checkout@v3

- name: Get Ballerina Version
run: |
BAL_VERSION=$(grep -w 'ballerinaLangVersion' gradle.properties | cut -d= -f2 | rev | cut --complement -d- -f1 | rev)
if [ -z "$BAL_VERSION" ]; then
BAL_VERSION="latest"
fi
echo "BAL_VERSION=$BAL_VERSION" >> $GITHUB_ENV
echo "Ballerina Version: $BAL_VERSION"

- name: Set Up Ballerina
uses: ballerina-platform/[email protected]
with:
version: ${{ env.BAL_VERSION }}

- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: 21.0.3

- name: Build with Gradle
env:
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: ./gradlew build -x test ${{ inputs.additional-build-flags }}

- name: Create lib directory if not exists
run: mkdir -p ballerina/lib

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
env:
TRIVY_DB_REPOSITORY: ghcr.io/aquasecurity/trivy-db,public.ecr.aws/aquasecurity/trivy-db
TRIVY_JAVA_DB_REPOSITORY: ghcr.io/aquasecurity/trivy-java-db,public.ecr.aws/aquasecurity/trivy-java-db
with:
scan-type: "rootfs"
scan-ref: "${{ github.workspace }}/ballerina/lib"
format: "table"
timeout: "10m0s"
exit-code: "1"
scanners: "vuln"
cache-dir: "/tmp/trivy-cache"
Loading