-
Notifications
You must be signed in to change notification settings - Fork 621
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
Fix bitbucket pipeline #304
Fix bitbucket pipeline #304
Conversation
…_bitbucket_publish_description
…_bitbucket_publish_description
…_bitbucket_pipeline
Fix bitbucket pipeline
@CodiumAI-Agent /review |
PR Analysis
PR Feedback
How to use
|
PR Analysis
PR Feedback
|
…_bitbucket_pipeline
async def run_action(): | ||
pull_request_id = os.environ.get("BITBUCKET_PR_ID", '') | ||
slug = os.environ.get("BITBUCKET_REPO_SLUG", '') | ||
workspace = os.environ.get("BITBUCKET_WORKSPACE", '') | ||
bearer_token = os.environ.get('BITBUCKET_BEARER_TOKEN', None) | ||
OPENAI_KEY = os.environ.get('OPENAI_API_KEY') or os.environ.get('OPENAI.KEY') | ||
OPENAI_ORG = os.environ.get('OPENAI_ORG') or os.environ.get('OPENAI.ORG') | ||
|
||
# Check if required environment variables are set | ||
if not bearer_token: | ||
print("BITBUCKET_BEARER_TOKEN not set") | ||
return | ||
|
||
if not OPENAI_KEY: | ||
print("OPENAI_KEY not set") | ||
return | ||
|
||
# Set the environment variables in the settings | ||
get_settings().set("BITBUCKET.BEARER_TOKEN", bearer_token) | ||
get_settings().set("OPENAI.KEY", OPENAI_KEY) | ||
if OPENAI_ORG: | ||
get_settings().set("OPENAI.ORG", OPENAI_ORG) | ||
|
||
if pull_request_id and slug and workspace: | ||
pr_url = f"https://bitbucket.org/{workspace}/{slug}/pull-requests/{pull_request_id}" | ||
await PRReviewer(pr_url).run() | ||
|
||
if __name__ == "__main__": | ||
asyncio.run(run_action()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Consider handling exceptions for the async function run_action to prevent the program from crashing in case of errors.
async def run_action(): | |
pull_request_id = os.environ.get("BITBUCKET_PR_ID", '') | |
slug = os.environ.get("BITBUCKET_REPO_SLUG", '') | |
workspace = os.environ.get("BITBUCKET_WORKSPACE", '') | |
bearer_token = os.environ.get('BITBUCKET_BEARER_TOKEN', None) | |
OPENAI_KEY = os.environ.get('OPENAI_API_KEY') or os.environ.get('OPENAI.KEY') | |
OPENAI_ORG = os.environ.get('OPENAI_ORG') or os.environ.get('OPENAI.ORG') | |
# Check if required environment variables are set | |
if not bearer_token: | |
print("BITBUCKET_BEARER_TOKEN not set") | |
return | |
if not OPENAI_KEY: | |
print("OPENAI_KEY not set") | |
return | |
# Set the environment variables in the settings | |
get_settings().set("BITBUCKET.BEARER_TOKEN", bearer_token) | |
get_settings().set("OPENAI.KEY", OPENAI_KEY) | |
if OPENAI_ORG: | |
get_settings().set("OPENAI.ORG", OPENAI_ORG) | |
if pull_request_id and slug and workspace: | |
pr_url = f"https://bitbucket.org/{workspace}/{slug}/pull-requests/{pull_request_id}" | |
await PRReviewer(pr_url).run() | |
if __name__ == "__main__": | |
asyncio.run(run_action()) | |
async def run_action(): | |
try: | |
pull_request_id = os.environ.get("BITBUCKET_PR_ID", '') | |
slug = os.environ.get("BITBUCKET_REPO_SLUG", '') | |
workspace = os.environ.get("BITBUCKET_WORKSPACE", '') | |
bearer_token = os.environ.get('BITBUCKET_BEARER_TOKEN', None) | |
OPENAI_KEY = os.environ.get('OPENAI_API_KEY') or os.environ.get('OPENAI.KEY') | |
OPENAI_ORG = os.environ.get('OPENAI_ORG') or os.environ.get('OPENAI.ORG') | |
# Check if required environment variables are set | |
if not bearer_token: | |
print("BITBUCKET_BEARER_TOKEN not set") | |
return | |
if not OPENAI_KEY: | |
print("OPENAI_KEY not set") | |
return | |
# Set the environment variables in the settings | |
get_settings().set("BITBUCKET.BEARER_TOKEN", bearer_token) | |
get_settings().set("OPENAI.KEY", OPENAI_KEY) | |
if OPENAI_ORG: | |
get_settings().set("OPENAI.ORG", OPENAI_ORG) | |
if pull_request_id and slug and workspace: | |
pr_url = f"https://bitbucket.org/{workspace}/{slug}/pull-requests/{pull_request_id}" | |
await PRReviewer(pr_url).run() | |
except Exception as e: | |
print(f"An error occurred: {e}") | |
if __name__ == "__main__": | |
asyncio.run(run_action()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add support for pt comments?
Dockerfile.bitbucket_pipeline
Outdated
FROM python:3.10 as base | ||
|
||
WORKDIR /app | ||
ADD pyproject.toml . | ||
ADD requirements.txt . | ||
RUN pip install . && rm pyproject.toml requirements.txt | ||
ENV PYTHONPATH=/app | ||
ADD pr_agent pr_agent | ||
ADD bitbucket_pipeline/entrypoint.sh / | ||
RUN chmod +x /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Consider using a multi-stage build to reduce the size of the final Docker image.
FROM python:3.10 as base | |
WORKDIR /app | |
ADD pyproject.toml . | |
ADD requirements.txt . | |
RUN pip install . && rm pyproject.toml requirements.txt | |
ENV PYTHONPATH=/app | |
ADD pr_agent pr_agent | |
ADD bitbucket_pipeline/entrypoint.sh / | |
RUN chmod +x /entrypoint.sh | |
ENTRYPOINT ["/entrypoint.sh"] | |
# First stage: build | |
FROM python:3.10 as builder | |
WORKDIR /app | |
ADD pyproject.toml . | |
ADD requirements.txt . | |
RUN pip install . && rm pyproject.toml requirements.txt | |
# Second stage: runtime | |
FROM python:3.10-slim as runtime | |
COPY --from=builder /app /app | |
ENV PYTHONPATH=/app | |
ADD pr_agent pr_agent | |
ADD bitbucket_pipeline/entrypoint.sh / | |
RUN chmod +x /entrypoint.sh | |
ENTRYPOINT ["/entrypoint.sh"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that won't work, no dependencies in "runtime" target. But I suggest moving this to the docker/Dockerfile as a new target, follow the other examples in this file @sarbjitsinghgrewal
docker-compose.yml
Outdated
version: '3' | ||
services: | ||
myapp: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.bitbucket_pipeline | ||
ports: | ||
- "8080:80" | ||
environment: | ||
- BITBUCKET_BRANCH=${BITBUCKET_BRANCH} | ||
- BITBUCKET_BUILD_NUMBER=${BITBUCKET_BUILD_NUMBER} | ||
- BITBUCKET_CLONE_DIR=${BITBUCKET_CLONE_DIR} | ||
- BITBUCKET_COMMIT=${BITBUCKET_COMMIT} | ||
- BITBUCKET_GIT_HTTP_ORIGIN=${BITBUCKET_GIT_HTTP_ORIGIN} | ||
- BITBUCKET_GIT_SSH_ORIGIN=${BITBUCKET_GIT_SSH_ORIGIN} | ||
- BITBUCKET_PIPELINE_UUID=${BITBUCKET_PIPELINE_UUID} | ||
- BITBUCKET_PROJECT_KEY=${BITBUCKET_PROJECT_KEY} | ||
- BITBUCKET_PROJECT_UUID=${BITBUCKET_PROJECT_UUID} | ||
- BITBUCKET_PR_DESTINATION_BRANCH=${BITBUCKET_PR_DESTINATION_BRANCH} | ||
- BITBUCKET_PR_DESTINATION_COMMIT=${BITBUCKET_PR_DESTINATION_COMMIT} | ||
- BITBUCKET_PR_ID=${BITBUCKET_PR_ID} | ||
- BITBUCKET_REPO_FULL_NAME=${BITBUCKET_REPO_FULL_NAME} | ||
- BITBUCKET_REPO_IS_PRIVATE=${BITBUCKET_REPO_IS_PRIVATE} | ||
- BITBUCKET_REPO_OWNER=${BITBUCKET_REPO_OWNER} | ||
- BITBUCKET_REPO_OWNER_UUID=${BITBUCKET_REPO_OWNER_UUID} | ||
- BITBUCKET_REPO_SLUG=${BITBUCKET_REPO_SLUG} | ||
- BITBUCKET_REPO_UUID=${BITBUCKET_REPO_UUID} | ||
- BITBUCKET_SSH_KEY_FILE=${BITBUCKET_SSH_KEY_FILE} | ||
- BITBUCKET_STEP_RUN_NUMBER=${BITBUCKET_STEP_RUN_NUMBER} | ||
- BITBUCKET_STEP_TRIGGERER_UUID=${BITBUCKET_STEP_TRIGGERER_UUID} | ||
- BITBUCKET_STEP_UUID=${BITBUCKET_STEP_UUID} | ||
- BITBUCKET_WORKSPACE=${BITBUCKET_WORKSPACE} | ||
- CI=${CI} | ||
- DOCKER_HOST=${DOCKER_HOST} | ||
- PIPELINES_JWT_TOKEN=${PIPELINES_JWT_TOKEN} | ||
- OPENAI_API_KEY=${OPENAI_API_KEY} | ||
- BITBUCKET_BEARER_TOKEN=${BITBUCKET_BEARER_TOKEN} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Consider using version '3.8' or later for the Docker Compose file to take advantage of the latest features and options.
version: '3' | |
services: | |
myapp: | |
build: | |
context: . | |
dockerfile: Dockerfile.bitbucket_pipeline | |
ports: | |
- "8080:80" | |
environment: | |
- BITBUCKET_BRANCH=${BITBUCKET_BRANCH} | |
- BITBUCKET_BUILD_NUMBER=${BITBUCKET_BUILD_NUMBER} | |
- BITBUCKET_CLONE_DIR=${BITBUCKET_CLONE_DIR} | |
- BITBUCKET_COMMIT=${BITBUCKET_COMMIT} | |
- BITBUCKET_GIT_HTTP_ORIGIN=${BITBUCKET_GIT_HTTP_ORIGIN} | |
- BITBUCKET_GIT_SSH_ORIGIN=${BITBUCKET_GIT_SSH_ORIGIN} | |
- BITBUCKET_PIPELINE_UUID=${BITBUCKET_PIPELINE_UUID} | |
- BITBUCKET_PROJECT_KEY=${BITBUCKET_PROJECT_KEY} | |
- BITBUCKET_PROJECT_UUID=${BITBUCKET_PROJECT_UUID} | |
- BITBUCKET_PR_DESTINATION_BRANCH=${BITBUCKET_PR_DESTINATION_BRANCH} | |
- BITBUCKET_PR_DESTINATION_COMMIT=${BITBUCKET_PR_DESTINATION_COMMIT} | |
- BITBUCKET_PR_ID=${BITBUCKET_PR_ID} | |
- BITBUCKET_REPO_FULL_NAME=${BITBUCKET_REPO_FULL_NAME} | |
- BITBUCKET_REPO_IS_PRIVATE=${BITBUCKET_REPO_IS_PRIVATE} | |
- BITBUCKET_REPO_OWNER=${BITBUCKET_REPO_OWNER} | |
- BITBUCKET_REPO_OWNER_UUID=${BITBUCKET_REPO_OWNER_UUID} | |
- BITBUCKET_REPO_SLUG=${BITBUCKET_REPO_SLUG} | |
- BITBUCKET_REPO_UUID=${BITBUCKET_REPO_UUID} | |
- BITBUCKET_SSH_KEY_FILE=${BITBUCKET_SSH_KEY_FILE} | |
- BITBUCKET_STEP_RUN_NUMBER=${BITBUCKET_STEP_RUN_NUMBER} | |
- BITBUCKET_STEP_TRIGGERER_UUID=${BITBUCKET_STEP_TRIGGERER_UUID} | |
- BITBUCKET_STEP_UUID=${BITBUCKET_STEP_UUID} | |
- BITBUCKET_WORKSPACE=${BITBUCKET_WORKSPACE} | |
- CI=${CI} | |
- DOCKER_HOST=${DOCKER_HOST} | |
- PIPELINES_JWT_TOKEN=${PIPELINES_JWT_TOKEN} | |
- OPENAI_API_KEY=${OPENAI_API_KEY} | |
- BITBUCKET_BEARER_TOKEN=${BITBUCKET_BEARER_TOKEN} | |
version: '3.8' | |
services: | |
myapp: | |
build: | |
context: . | |
dockerfile: Dockerfile.bitbucket_pipeline | |
ports: | |
- "8080:80" | |
environment: | |
- BITBUCKET_BRANCH=${BITBUCKET_BRANCH} | |
- BITBUCKET_BUILD_NUMBER=${BITBUCKET_BUILD_NUMBER} | |
- BITBUCKET_CLONE_DIR=${BITBUCKET_CLONE_DIR} | |
- BITBUCKET_COMMIT=${BITBUCKET_COMMIT} | |
- BITBUCKET_GIT_HTTP_ORIGIN=${BITBUCKET_GIT_HTTP_ORIGIN} | |
- BITBUCKET_GIT_SSH_ORIGIN=${BITBUCKET_GIT_SSH_ORIGIN} | |
- BITBUCKET_PIPELINE_UUID=${BITBUCKET_PIPELINE_UUID} | |
- BITBUCKET_PROJECT_KEY=${BITBUCKET_PROJECT_KEY} | |
- BITBUCKET_PROJECT_UUID=${BITBUCKET_PROJECT_UUID} | |
- BITBUCKET_PR_DESTINATION_BRANCH=${BITBUCKET_PR_DESTINATION_BRANCH} | |
- BITBUCKET_PR_DESTINATION_COMMIT=${BITBUCKET_PR_DESTINATION_COMMIT} | |
- BITBUCKET_PR_ID=${BITBUCKET_PR_ID} | |
- BITBUCKET_REPO_FULL_NAME=${BITBUCKET_REPO_FULL_NAME} | |
- BITBUCKET_REPO_IS_PRIVATE=${BITBUCKET_REPO_IS_PRIVATE} | |
- BITBUCKET_REPO_OWNER=${BITBUCKET_REPO_OWNER} | |
- BITBUCKET_REPO_OWNER_UUID=${BITBUCKET_REPO_OWNER_UUID} | |
- BITBUCKET_REPO_SLUG=${BITBUCKET_REPO_SLUG} | |
- BITBUCKET_REPO_UUID=${BITBUCKET_REPO_UUID} | |
- BITBUCKET_SSH_KEY_FILE=${BITBUCKET_SSH_KEY_FILE} | |
- BITBUCKET_STEP_RUN_NUMBER=${BITBUCKET_STEP_RUN_NUMBER} | |
- BITBUCKET_STEP_TRIGGERER_UUID=${BITBUCKET_STEP_TRIGGERER_UUID} | |
- BITBUCKET_STEP_UUID=${BITBUCKET_STEP_UUID} | |
- BITBUCKET_WORKSPACE=${BITBUCKET_WORKSPACE} | |
- CI=${CI} | |
- DOCKER_HOST=${DOCKER_HOST} | |
- PIPELINES_JWT_TOKEN=${PIPELINES_JWT_TOKEN} | |
- OPENAI_API_KEY=${OPENAI_API_KEY} | |
- BITBUCKET_BEARER_TOKEN=${BITBUCKET_BEARER_TOKEN} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of docker compose here? Maybe you added it to the repo by mistake? It's not documented anywhere and I think it's not necessary. It's the responsibility of the user to host the docker image properly. We might need to add better documentation about it in the future
Dockerfile.bitbucket_pipeline
Outdated
FROM python:3.10 as base | ||
|
||
WORKDIR /app | ||
ADD pyproject.toml . | ||
ADD requirements.txt . | ||
RUN pip install . && rm pyproject.toml requirements.txt | ||
ENV PYTHONPATH=/app | ||
ADD pr_agent pr_agent | ||
ADD bitbucket_pipeline/entrypoint.sh / | ||
RUN chmod +x /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that won't work, no dependencies in "runtime" target. But I suggest moving this to the docker/Dockerfile as a new target, follow the other examples in this file @sarbjitsinghgrewal
docker-compose.yml
Outdated
version: '3' | ||
services: | ||
myapp: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.bitbucket_pipeline | ||
ports: | ||
- "8080:80" | ||
environment: | ||
- BITBUCKET_BRANCH=${BITBUCKET_BRANCH} | ||
- BITBUCKET_BUILD_NUMBER=${BITBUCKET_BUILD_NUMBER} | ||
- BITBUCKET_CLONE_DIR=${BITBUCKET_CLONE_DIR} | ||
- BITBUCKET_COMMIT=${BITBUCKET_COMMIT} | ||
- BITBUCKET_GIT_HTTP_ORIGIN=${BITBUCKET_GIT_HTTP_ORIGIN} | ||
- BITBUCKET_GIT_SSH_ORIGIN=${BITBUCKET_GIT_SSH_ORIGIN} | ||
- BITBUCKET_PIPELINE_UUID=${BITBUCKET_PIPELINE_UUID} | ||
- BITBUCKET_PROJECT_KEY=${BITBUCKET_PROJECT_KEY} | ||
- BITBUCKET_PROJECT_UUID=${BITBUCKET_PROJECT_UUID} | ||
- BITBUCKET_PR_DESTINATION_BRANCH=${BITBUCKET_PR_DESTINATION_BRANCH} | ||
- BITBUCKET_PR_DESTINATION_COMMIT=${BITBUCKET_PR_DESTINATION_COMMIT} | ||
- BITBUCKET_PR_ID=${BITBUCKET_PR_ID} | ||
- BITBUCKET_REPO_FULL_NAME=${BITBUCKET_REPO_FULL_NAME} | ||
- BITBUCKET_REPO_IS_PRIVATE=${BITBUCKET_REPO_IS_PRIVATE} | ||
- BITBUCKET_REPO_OWNER=${BITBUCKET_REPO_OWNER} | ||
- BITBUCKET_REPO_OWNER_UUID=${BITBUCKET_REPO_OWNER_UUID} | ||
- BITBUCKET_REPO_SLUG=${BITBUCKET_REPO_SLUG} | ||
- BITBUCKET_REPO_UUID=${BITBUCKET_REPO_UUID} | ||
- BITBUCKET_SSH_KEY_FILE=${BITBUCKET_SSH_KEY_FILE} | ||
- BITBUCKET_STEP_RUN_NUMBER=${BITBUCKET_STEP_RUN_NUMBER} | ||
- BITBUCKET_STEP_TRIGGERER_UUID=${BITBUCKET_STEP_TRIGGERER_UUID} | ||
- BITBUCKET_STEP_UUID=${BITBUCKET_STEP_UUID} | ||
- BITBUCKET_WORKSPACE=${BITBUCKET_WORKSPACE} | ||
- CI=${CI} | ||
- DOCKER_HOST=${DOCKER_HOST} | ||
- PIPELINES_JWT_TOKEN=${PIPELINES_JWT_TOKEN} | ||
- OPENAI_API_KEY=${OPENAI_API_KEY} | ||
- BITBUCKET_BEARER_TOKEN=${BITBUCKET_BEARER_TOKEN} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of docker compose here? Maybe you added it to the repo by mistake? It's not documented anywhere and I think it's not necessary. It's the responsibility of the user to host the docker image properly. We might need to add better documentation about it in the future
async def run_action(): | ||
pull_request_id = os.environ.get("BITBUCKET_PR_ID", '') | ||
slug = os.environ.get("BITBUCKET_REPO_SLUG", '') | ||
workspace = os.environ.get("BITBUCKET_WORKSPACE", '') | ||
bearer_token = os.environ.get('BITBUCKET_BEARER_TOKEN', None) | ||
OPENAI_KEY = os.environ.get('OPENAI_API_KEY') or os.environ.get('OPENAI.KEY') | ||
OPENAI_ORG = os.environ.get('OPENAI_ORG') or os.environ.get('OPENAI.ORG') | ||
|
||
# Check if required environment variables are set | ||
if not bearer_token: | ||
print("BITBUCKET_BEARER_TOKEN not set") | ||
return | ||
|
||
if not OPENAI_KEY: | ||
print("OPENAI_KEY not set") | ||
return | ||
|
||
# Set the environment variables in the settings | ||
get_settings().set("BITBUCKET.BEARER_TOKEN", bearer_token) | ||
get_settings().set("OPENAI.KEY", OPENAI_KEY) | ||
if OPENAI_ORG: | ||
get_settings().set("OPENAI.ORG", OPENAI_ORG) | ||
|
||
if pull_request_id and slug and workspace: | ||
pr_url = f"https://bitbucket.org/{workspace}/{slug}/pull-requests/{pull_request_id}" | ||
await PRReviewer(pr_url).run() | ||
|
||
if __name__ == "__main__": | ||
asyncio.run(run_action()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add support for pt comments?
pr_agent/settings/configuration.toml
Outdated
@@ -1,7 +1,7 @@ | |||
[config] | |||
model="gpt-4" | |||
fallback_models=["gpt-3.5-turbo-16k"] | |||
git_provider="github" | |||
git_provider="bitbucket" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git_provider="bitbucket" | |
git_provider="github" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not change the default value here!
pr_agent/settings/configuration.toml
Outdated
@@ -55,6 +55,7 @@ extra_instructions = "" | |||
[github] | |||
# The type of deployment to create. Valid values are 'app' or 'user'. | |||
deployment_type = "user" | |||
user_token = "" # A GitHub personal access token with 'repo' scope. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user_token = "" # A GitHub personal access token with 'repo' scope. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be placed in the .secrets.toml file!
pr_agent/settings/configuration.toml
Outdated
@@ -100,6 +101,21 @@ polling_interval_seconds = 30 | |||
# token to authenticate in the patch server | |||
# patch_server_token = "" | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't belong here! Should be placed by every user in their .sercrets.toml file
pipelines: | ||
pull-requests: | ||
'**': | ||
- step: | ||
name: PR Agent Pipeline | ||
caches: | ||
- pip | ||
image: python:3.8 | ||
services: | ||
- docker | ||
script: | ||
- git clone https://github.com/Codium-ai/pr-agent.git | ||
- cd pr-agent | ||
- docker build -t bitbucket_runner:latest -f Dockerfile.bitbucket_pipeline . | ||
- docker run -e OPENAI_API_KEY=$OPENAI_API_KEY -e BITBUCKET_BEARER_TOKEN=$BITBUCKET_BEARER_TOKEN -e BITBUCKET_PR_ID=$BITBUCKET_PR_ID -e BITBUCKET_REPO_SLUG=$BITBUCKET_REPO_SLUG -e BITBUCKET_WORKSPACE=$BITBUCKET_WORKSPACE bitbucket_runner:latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please surround it code blocks: ```yaml
The environment variable should be in the yaml or run separately? if its separate, please use different code block.
…t_pipeline Fix bitbucket pipeline
Bitbucket Pipeline Review Creation
I have completed the Bitbucket Pipeline setup, which serves the purpose of generating reviews for pull requests. Whenever a user initiates a pull request on Bitbucket, this pipeline runs automatically and appends a review as a comment to the respective pull request.
Here's an overview of the workflow for this pipeline:
Step 1: We begin by cloning the repository from https://github.com/Codium-ai/pr-agent.git using this pipeline.
Step 2: The pipeline executes the command "cd pr-agent" to navigate into this directory.
Step 3: To build and run the file, we employ Docker Compose. As a prerequisite, we install Docker Compose with the command "pip install docker-compose."
Step 4: The review is created for the pull request by executing the command "docker-compose up --build." This command initiates the build and runs it, ultimately producing the review for the pull request.
New files introduced for this pipeline include:
docker-compose.yml: This file is employed to create the build and execute it.
Dockerfile.bitbucket_pipeline: This Dockerfile is utilized by the docker-compose file.
entrypoint.sh: You can find this file within the bitbucket_pipeline folder.
bitbucket_pipeline_runner.py: I have created this file in the servers folder, and it contains the actual script responsible for running the PRReviewer class.
Attached is a screenshot demonstrating a review created by this pipeline for reference.