Skip to content

Commit

Permalink
Feature/jira gitlab commands (#4)
Browse files Browse the repository at this point in the history
* Switched to Gemini-pro. Added JIRA and GitLab commands.

* Added dependencies for JIRA and GitLab commands.

* Added JIRA command

* Added JIRA and GitLab commands

* Added docs for JIRA and LangSmith configuration

* Added JIRA command

* Added folders and files to exclude

* updated google-cloud-aiplatform

* Added gitlab command

* updated comment

* Added config steps for JIRA and GitLab

* Added step to create PAT

* Switched to Gemini Pro

* Added PROJECT_ID and LOCATION env vars for CICD pipeline

* Updated GitHub actions versions

* Update readme

* added json format

* Fixed typo

* added env vars

* Added setup steps

* switched to new folder structure

* Added steps for env vars setup

* Added resource manager api

* added workflow rule

* added circleci config

* added all env vars

* added CircleCI config
  • Loading branch information
gitrey authored Apr 2, 2024
1 parent ccc409b commit 0c998b6
Show file tree
Hide file tree
Showing 10 changed files with 704 additions and 51 deletions.
145 changes: 145 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
version: 2.1

jobs:
ai-insights-code-review:
docker:
- image: python:3.11-slim
steps:
- checkout
- run:
command: |
pip install virtualenv
virtualenv venv
source venv/bin/activate
cd outer-loop-cli/src
pip install -r requirements.txt
pip install --editable .
cd ../..
devai echo
echo $(pwd)
export PROJECT_ID=$(echo $PROJECT_ID)
export LOCATION=$(echo $LOCATION)

export JIRA_USERNAME=$(echo $JIRA_USERNAME)
export JIRA_PROJECT_KEY=$(echo $JIRA_PROJECT_KEY)
export JIRA_INSTANCE_URL=$(echo $JIRA_INSTANCE_URL)
export JIRA_API_TOKEN=$(echo $JIRA_API_TOKEN)

export GITLAB_URL=$(echo $GITLAB_URL)
export GITLAB_REPOSITORY=$(echo $GITLAB_REPOSITORY)
export GITLAB_PERSONAL_ACCESS_TOKEN=$(echo $GITLAB_PERSONAL_ACCESS_TOKEN)
export GITLAB_BRANCH=$(echo $GITLAB_BRANCH)
export GITLAB_BASE_BRANCH=$(echo $GITLAB_BASE_BRANCH)

export LANGCHAIN_TRACING_V2=$(echo $LANGCHAIN_TRACING_V2)
export LANGCHAIN_ENDPOINT=$(echo $LANGCHAIN_ENDPOINT)
export LANGCHAIN_API_KEY=$(echo $LANGCHAIN_API_KEY)

export GOOGLE_CLOUD_CREDENTIALS=$(echo $GOOGLE_CLOUD_CREDENTIALS)
echo $GOOGLE_CLOUD_CREDENTIALS > service-account-key.json
export GOOGLE_APPLICATION_CREDENTIALS="service-account-key.json"
echo ""
echo "============================================================="
echo "Code Review"
devai review code -c ./sample-app/src/main/java/anthos/samples/bankofanthos/balancereader
echo ""
echo "============================================================="

ai-insights-security-review:
docker:
- image: python:3.11-slim
steps:
- checkout
- run:
command: |
pip install virtualenv
virtualenv venv
source venv/bin/activate
cd outer-loop-cli/src
pip install -r requirements.txt
pip install --editable .
cd ../..
devai echo
echo $(pwd)
export PROJECT_ID=$(echo $PROJECT_ID)
export LOCATION=$(echo $LOCATION)

export JIRA_USERNAME=$(echo $JIRA_USERNAME)
export JIRA_PROJECT_KEY=$(echo $JIRA_PROJECT_KEY)
export JIRA_INSTANCE_URL=$(echo $JIRA_INSTANCE_URL)
export JIRA_API_TOKEN=$(echo $JIRA_API_TOKEN)

export GITLAB_URL=$(echo $GITLAB_URL)
export GITLAB_REPOSITORY=$(echo $GITLAB_REPOSITORY)
export GITLAB_PERSONAL_ACCESS_TOKEN=$(echo $GITLAB_PERSONAL_ACCESS_TOKEN)
export GITLAB_BRANCH=$(echo $GITLAB_BRANCH)
export GITLAB_BASE_BRANCH=$(echo $GITLAB_BASE_BRANCH)

export LANGCHAIN_TRACING_V2=$(echo $LANGCHAIN_TRACING_V2)
export LANGCHAIN_ENDPOINT=$(echo $LANGCHAIN_ENDPOINT)
export LANGCHAIN_API_KEY=$(echo $LANGCHAIN_API_KEY)

export GOOGLE_CLOUD_CREDENTIALS=$(echo $GOOGLE_CLOUD_CREDENTIALS)
echo $GOOGLE_CLOUD_CREDENTIALS > service-account-key.json
export GOOGLE_APPLICATION_CREDENTIALS="service-account-key.json"
echo ""
echo "============================================================="
echo "Performance Review"
devai review performance -c ./sample-app/src/main/java/anthos/samples/bankofanthos/balancereader
echo ""
echo "============================================================="

ai-insights-performance-review:
docker:
- image: python:3.11-slim
steps:
- checkout
- run:
command: |
pip install virtualenv
virtualenv venv
source venv/bin/activate
cd outer-loop-cli/src
pip install -r requirements.txt
pip install --editable .
cd ../..
devai echo
echo $(pwd)
export PROJECT_ID=$(echo $PROJECT_ID)
export LOCATION=$(echo $LOCATION)

export JIRA_USERNAME=$(echo $JIRA_USERNAME)
export JIRA_PROJECT_KEY=$(echo $JIRA_PROJECT_KEY)
export JIRA_INSTANCE_URL=$(echo $JIRA_INSTANCE_URL)
export JIRA_API_TOKEN=$(echo $JIRA_API_TOKEN)

export GITLAB_URL=$(echo $GITLAB_URL)
export GITLAB_REPOSITORY=$(echo $GITLAB_REPOSITORY)
export GITLAB_PERSONAL_ACCESS_TOKEN=$(echo $GITLAB_PERSONAL_ACCESS_TOKEN)
export GITLAB_BRANCH=$(echo $GITLAB_BRANCH)
export GITLAB_BASE_BRANCH=$(echo $GITLAB_BASE_BRANCH)

export LANGCHAIN_TRACING_V2=$(echo $LANGCHAIN_TRACING_V2)
export LANGCHAIN_ENDPOINT=$(echo $LANGCHAIN_ENDPOINT)
export LANGCHAIN_API_KEY=$(echo $LANGCHAIN_API_KEY)

export GOOGLE_CLOUD_CREDENTIALS=$(echo $GOOGLE_CLOUD_CREDENTIALS)
echo $GOOGLE_CLOUD_CREDENTIALS > service-account-key.json
export GOOGLE_APPLICATION_CREDENTIALS="service-account-key.json"
echo ""
echo "============================================================="
echo "Security Review"
devai review security -c ./sample-app/src/main/java/anthos/samples/bankofanthos/balancereader
echo ""
echo "============================================================="

workflows:
ai-insights-workflow:
jobs:
- ai-insights-code-review
- ai-insights-security-review
- ai-insights-performance-review

6 changes: 3 additions & 3 deletions .github/workflows/devai-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: List files in the repository
run: |
ls ${{ github.workspace }}
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.11.7'
- run: pip install google-cloud-aiplatform
Expand All @@ -37,7 +37,7 @@ jobs:
shell: bash

- name: Security Review
run: echo '## Performance Review Results 🚀' >> $GITHUB_STEP_SUMMARY
run: echo '## Security Review Results 🚀' >> $GITHUB_STEP_SUMMARY
- run: echo "$(devai review security -c ${{ github.workspace }}/sample-app/src/main/java/anthos/samples/bankofanthos/balancereader)" >> $GITHUB_STEP_SUMMARY
shell: bash

Expand Down
33 changes: 28 additions & 5 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# workflow:
# rules:
# - if: $CI_PIPELINE_SOURCE == "web"

image: python:3.11-slim

variables:
Expand All @@ -12,7 +16,7 @@ before_script:
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
- cd cli-code-api/src
- cd outer-loop-cli/src
- pip install -r requirements.txt
- pip install --editable .
- cd ../..
Expand All @@ -25,9 +29,28 @@ build-job:
- echo "Hello, $GITLAB_USER_LOGIN!"
- devai echo
- echo $(pwd)
- export PROJECT_ID=$(echo $PROJECT_ID)
- export LOCATION=$(echo $LOCATION)

- export LANGCHAIN_TRACING_V2=$(echo $LANGCHAIN_TRACING_V2)
- export LANGCHAIN_ENDPOINT=$(echo $LANGCHAIN_ENDPOINT)
- export LANGCHAIN_API_KEY=$(echo $LANGCHAIN_API_KEY)

- export JIRA_API_TOKEN=$(echo $JIRA_API_TOKEN)
- export JIRA_USERNAME=$(echo $JIRA_USERNAME)
- export JIRA_INSTANCE_URL=$(echo $JIRA_INSTANCE_URL)
- export JIRA_PROJECT_KEY=$(echo $JIRA_PROJECT_KEY)

- export GITLAB_PERSONAL_ACCESS_TOKEN=$(echo $GITLAB_PERSONAL_ACCESS_TOKEN)
- export GITLAB_URL=$(echo $GITLAB_URL)
- export GITLAB_REPOSITORY=$(echo $GITLAB_REPOSITORY)
- export GITLAB_BRANCH=$(echo $GITLAB_BRANCH)
- export GITLAB_BASE_BRANCH=$(echo $GITLAB_BASE_BRANCH)

- export GOOGLE_CLOUD_CREDENTIALS=$(echo $GOOGLE_CLOUD_CREDENTIALS)
- echo $GOOGLE_CLOUD_CREDENTIALS > service-account-key.json
- echo $GOOGLE_CLOUD_CREDENTIALS > service-account-key.json
- export GOOGLE_APPLICATION_CREDENTIALS="service-account-key.json"
- devai review code -c ./cli-code-api/sample-app/src/main/java/anthos/samples/bankofanthos/balancereader
- devai review performance -c ./cli-code-api/sample-app/src/main/java/anthos/samples/bankofanthos/balancereader
- devai review security -c ./cli-code-api/sample-app/src/main/java/anthos/samples/bankofanthos/balancereader

- devai review code -c ./sample-app/src/main/java/anthos/samples/bankofanthos/balancereader
- devai review performance -c ./sample-app/src/main/java/anthos/samples/bankofanthos/balancereader
- devai review security -c ./sample-app/src/main/java/anthos/samples/bankofanthos/balancereader
Loading

0 comments on commit 0c998b6

Please sign in to comment.