Skip to content

Commit

Permalink
skip pull-request event for dependabot[bot] user
Browse files Browse the repository at this point in the history
  • Loading branch information
raghunathd8 committed Nov 6, 2023
1 parent a3f1472 commit d1ec3c8
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 63 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/reusable-deploy-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: TEST CF APPS

on:
workflow_call:
secrets:
CF_API:
required: true
CF_DOMAIN:
required: true
CF_USERNAME:
required: true
CF_PASSWORD:
required: true
CF_ORG:
required: true
CF_SPACE:
required: true

jobs:
sample-app-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup java/jdk
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
java-package: jdk
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 'stable'
- name: Install grpcurl
run: go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
- name: Install yq
run: |
sudo add-apt-repository ppa:rmescandon/yq
sudo apt update
sudo apt install yq -y
- name: Install CloudFoundry cf cli
run: |
wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add -
echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list
sudo apt-get update
sudo apt-get install cf8-cli -y
cf8 --version
- name: Build Java apps
run: ./http2/gradlew clean build -p http2
- name: Logging into target CloudFoundry
run: cf8 login -a "${{ secrets.CF_API }}" -u "${{ secrets.CF_USERNAME }}" -p "${{ secrets.CF_PASSWORD }}" -o "${{ secrets.CF_ORG }}" -s "${{ secrets.CF_SPACE }}" --origin uaa
- name: Deploy CloudFoundry sample apps
run: cf8 push -f "${GITHUB_WORKSPACE}/http2/apps-manifest.yml" --var domain=${{ secrets.CF_DOMAIN }} --vars-file "${GITHUB_WORKSPACE}/http2/gradle.properties"
- name: Test Sample apps
run: |
echo "### Testing HTTP2_APP app ###"
yq e '.applications.[].name' "${GITHUB_WORKSPACE}/http2/apps-manifest.yml" | grep -i 'http2' | while read -r HTTP2_APP; do
echo "curl -v --http2-prior-knowledge -H 'Connection: close' 'https://$HTTP2_APP.${{ secrets.CF_DOMAIN }}'"
curl -v --http2-prior-knowledge -H "Connection: close" "https://$HTTP2_APP.${{ secrets.CF_DOMAIN }}"
done
echo "Testing GRPC apps"
grpcurl go-grpc-test.${{ secrets.CF_DOMAIN }}:443 example.Example.Run
grpcurl -proto http2/java-grpc/app/src/main/proto/example.proto java-grpc-test.${{ secrets.CF_DOMAIN }}:443 example.Example.Run
grpcurl -proto http2/node-grpc/example.proto node-grpc-test.${{ secrets.CF_DOMAIN }}:443 Example.Run
grpcurl -proto http2/python-grpc/example.proto python-grpc-test.${{ secrets.CF_DOMAIN }}:443 Example.Run
grpcurl -proto http2/ruby-grpc/example.proto ruby-grpc-test.${{ secrets.CF_DOMAIN }}:443 Example.Run
- name: Clean-up
if: success() || failure()
run: |
echo "Deleting apps and routes"
yq e '.applications.[].name' "${GITHUB_WORKSPACE}/http2/apps-manifest.yml" | while read -r app_name; do
echo "Deleting app: $app_name"
cf8 delete "$app_name" -r -f
done
85 changes: 22 additions & 63 deletions .github/workflows/test-sample-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,68 +9,27 @@ on:
types: [ opened, synchronize, reopened ]

jobs:
sample-app-test:
runs-on: ubuntu-latest
pull-request-event:
if: (github.event_name == 'pull_request') && (github.actor != 'dependabot[bot]')
concurrency: test-landscape
environment: cf_env
steps:
- name: Limit access
if: (github.event_name == 'pull_request' && github.actor == 'dependabot[bot]') || (github.event_name == 'pull_request_target' && github.actor != 'dependabot[bot]')
run: |
echo "Deployment not possible!"
exit 1
- name: Checkout
uses: actions/checkout@v3
- name: Setup java/jdk
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
java-package: jdk
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 'stable'
- name: Install grpcurl
run: go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
- name: Install yq
run: |
sudo add-apt-repository ppa:rmescandon/yq
sudo apt update
sudo apt install yq -y
- name: Install CloudFoundry cf cli
run: |
wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add -
echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list
sudo apt-get update
sudo apt-get install cf8-cli -y
cf8 --version
- name: Build Java apps
run: ./http2/gradlew clean build -p http2
- name: Logging into target CloudFoundry
run: cf8 login -a "${{ secrets.CF_API }}" -u "${{ secrets.CF_USERNAME }}" -p "${{ secrets.CF_PASSWORD }}" -o "${{ secrets.CF_ORG }}" -s "${{ secrets.CF_SPACE }}" --origin uaa
- name: Deploy CloudFoundry sample apps
run: cf8 push -f "${GITHUB_WORKSPACE}/http2/apps-manifest.yml" --var domain=${{ secrets.CF_DOMAIN }} --vars-file "${GITHUB_WORKSPACE}/http2/gradle.properties"
- name: Test Sample apps
run: |
echo "### Testing HTTP2_APP app ###"
yq e '.applications.[].name' "${GITHUB_WORKSPACE}/http2/apps-manifest.yml" | grep -i 'http2' | while read -r HTTP2_APP; do
echo "curl -v --http2-prior-knowledge -H 'Connection: close' 'https://$HTTP2_APP.${{ secrets.CF_DOMAIN }}'"
curl -v --http2-prior-knowledge -H "Connection: close" "https://$HTTP2_APP.${{ secrets.CF_DOMAIN }}"
done
echo "Testing GRPC apps"
grpcurl go-grpc-test.${{ secrets.CF_DOMAIN }}:443 example.Example.Run
grpcurl -proto http2/java-grpc/app/src/main/proto/example.proto java-grpc-test.${{ secrets.CF_DOMAIN }}:443 example.Example.Run
grpcurl -proto http2/node-grpc/example.proto node-grpc-test.${{ secrets.CF_DOMAIN }}:443 Example.Run
grpcurl -proto http2/python-grpc/example.proto python-grpc-test.${{ secrets.CF_DOMAIN }}:443 Example.Run
grpcurl -proto http2/ruby-grpc/example.proto ruby-grpc-test.${{ secrets.CF_DOMAIN }}:443 Example.Run
- name: Clean-up
if: success() || failure()
run: |
echo "Deleting apps and routes"
yq e '.applications.[].name' "${GITHUB_WORKSPACE}/http2/apps-manifest.yml" | while read -r app_name; do
echo "Deleting app: $app_name"
cf8 delete "$app_name" -r -f
done
uses: ./.github/workflows/reusable-deploy-workflow.yml@fix-workflow-condition
secrets:
CF_API: ${{ secrets.CF_API }}
CF_DOMAIN: ${{ secrets.CF_DOMAIN }}
CF_USERNAME: ${{ secrets.CF_USERNAME }}
CF_PASSWORD: ${{ secrets.CF_PASSWORD }}
CF_ORG: ${{ secrets.CF_ORG }}
CF_SPACE: ${{ secrets.CF_SPACE }}
pull-request-target-event:
if: (github.event_name == 'pull_request_target') && (github.actor == 'dependabot[bot]')
concurrency: test-landscape
environment: cf_env
uses: ./.github/workflows/reusable-deploy-workflow.yml@fix-workflow-condition
secrets:
CF_API: ${{ secrets.CF_API }}
CF_DOMAIN: ${{ secrets.CF_DOMAIN }}
CF_USERNAME: ${{ secrets.CF_USERNAME }}
CF_PASSWORD: ${{ secrets.CF_PASSWORD }}
CF_ORG: ${{ secrets.CF_ORG }}
CF_SPACE: ${{ secrets.CF_SPACE }}

0 comments on commit d1ec3c8

Please sign in to comment.