Skip to content
Merged
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
20 changes: 11 additions & 9 deletions .github/workflows/dagger_hackathon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
GITHUB_TOKEN: ${{ secrets.DAGGER_HACKATHON_GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
CURRENT_BRANCH: ${{ github.head_ref }}
CURRENT_REPO: ${{ github.repository }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move everything to one env section

DAGGER_CLOUD_TOKEN: ${{ secrets.DAGGER_CLOUD_TOKEN }}
AZURE_OPENAI_ENDPOINT: https://vdfvdf.openai.azure.com/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dry up


steps:
- name: Checkout repo
Expand All @@ -25,25 +28,24 @@ jobs:
working-directory: docs/dagger/dagger-hackathon/
run: |
cat <<EOF > .env
OPENAI_BASE_URL=https://vdfvdf.openai.azure.com/
OPENAI_BASE_URL=${AZURE_OPENAI_ENDPOINT}
OPENAI_MODEL=gpt-4o
OPENAI_API_KEY=${OPENAI_API_KEY}
OPENAI_AZURE_VERSION=2024-12-01-preview
GITHUB_TOKEN=${GITHUB_TOKEN}
EOF

- name: Dagger Run Unit Tests
working-directory: docs/dagger/dagger-hackathon/
env:
DAGGER_SECRET_GITHUB_TOKEN: ${{ secrets.DAGGER_HACKATHON_GITHUB_TOKEN }}
run: |
export AZURE_OPENAI_API_KEY="${OPENAI_API_KEY}"
export AZURE_OPENAI_ENDPOINT="https://vdfvdf.openai.azure.com/"
export GITHUB_TOKEN="${GITHUB_TOKEN}"
export DAGGER_CLOUD_TOKEN="${DAGGER_CLOUD_TOKEN}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need this to trace

dagger call \
--source="." \
--github_branch="${CURRENT_BRANCH}" \
--github_repo="codetocloudorg/platform-engineering" \
--github_token=DAGGER_SECRET_GITHUB_TOKEN \
--azure_api_key="OPENAI_API_KEY" \
--azure_endpoint="https://vdfvdf.openai.azure.com/" \
--github_repo="${CURRENT_REPO}" \
--github_token=GITHUB_TOKEN \
--azure_openai_api_key=AZURE_OPENAI_API_KEY \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modify arg names

--azure_openai_endpoint="${AZURE_OPENAI_ENDPOINT}" \
fix-my-tests-agent

29 changes: 13 additions & 16 deletions docs/dagger/dagger-hackathon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Welcome to the Dagger hackathon hosted by the [CNCF](https://community.cncf.io/cloud-native-calgary/) and [Code to Cloud](https://www.codetocloud.io/)! By the end of this hack, you will have a good understanding of how to use Dagger and the various use cases it can help support.

👀 Here’s the end-to-end flow:
**👀 Here’s the end-to-end flow:**

![image](./assets/hack-overview.jpeg)

Expand All @@ -16,7 +16,7 @@ Welcome to the Dagger hackathon hosted by the [CNCF](https://community.cncf.io/c

5️⃣ Dagger agent inspects the issue using smart tools 🔍

6️⃣ A helpful comment appears on the PR 💬
6️⃣ A suggested code change appears on the PR 💬

## 🎯 Expected Outcomes

Expand Down Expand Up @@ -116,7 +116,7 @@ The below steps will take you through making a breaking change to a file in our
```
and confirm it fails
- Push the modified `addition.py` to your new feature branch
- In the GitHub UI, open a PR on the feature branch and compare to `main`
- In the GitHub UI, **open a PR** on the feature branch and compare to `main` (make sure to compare to `main` and not forked `main`)

---

Expand All @@ -125,21 +125,16 @@ The below steps will take you through making a breaking change to a file in our
<img src="./assets/spongebob_meme.jpg" alt="spongebob" width="400"/>

- Rename `docs/dagger/dagger-hackathon/.env-example` to `.env`
- Populate the placeholder keys with real values (we will provide for Hackathon day)
- Populate the placeholder keys with real values (we will provide the full API key during the hackathon)
- `OPENAI_API_KEY`: FT0Dd0iIglkzGbizOMUp79k0Frea7neDtVXRhFZ5m39CJJJcdfxFJQQJ99BEACYeBjFXJ3w3AAABACO
- `OPENAI_BASE_URL`: https://vdfvdf.openai.azure.com/
- Create environment variables for `GITHUB_TOKEN` and `AZURE_OPENAI_API_KEY`
A GitHub Token can be created in GitHub under Settings → Developer Settings → Create a classic token
A GitHub Token can be created in GitHub under Settings → Developer Settings → Create a classic token (you must have repo and workflow scopes)
Example:
```bash
export GITHUB_TOKEN="XXX"
```
The Azure OpenAI details can be found below:

- Azure OpenAI API Key: FT0Dd0iIglkzGbizOMUp79k0Frea7neDtVXRhFZ5m39CJJJcdfxFJQQJ99BEACYeBjFXJ3w3AAABACO
- Azure OpenAI Endpoint: https://vdfvdf.openai.azure.com/

> **Note:** The full API key will be provided during the hackathon.

- Put in your values and run in CLI:
- Fill in values for `github_branch`, `github_repo`, and `azure_openai_endpoint` (same as `OPENAI_BASE_URL`) and run in CLI:
```bash
dagger call \
--source="." \
Expand Down Expand Up @@ -192,8 +187,8 @@ Being able to navigate and explore logs in Dagger Cloud is a great skill to have

### ✅ Step 8: Trigger GitHub Action

- Delete the comment the Agent left on the PR in Step 6
- [Create GitHub secrets](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository) for everything in `.env` and name them `DAGGER_HACKATHON_GITHUB_TOKEN` and `OPENAI_API_KEY` for the GitHub token and Azure OpenAI API key respectively.
- Delete any comments the Agent left on the PR in Step 6
- [Create GitHub secrets](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository) for `DAGGER_CLOUD_TOKEN`, `DAGGER_HACKATHON_GITHUB_TOKEN` (what was `GITHUB_TOKEN`), and `OPENAI_API_KEY`.
- Make sure to update your GitHub Action to trigger on a pull request instead of a manual trigger.

Update the trigger from this:
Expand All @@ -211,7 +206,9 @@ on:
types: [opened, synchronize, reopened]
```

- Push your changes to Git and navigate back to your forked repo to see the GitHub Action running
- Push your changes to Git

- Now break the code in a different way in `addition.py` and push those changes. You should see a action running.

![image](./assets/run_unit_tests.png)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async def GetPrMetadata(self) -> PrMetadataResult:
"--head", f"{self.github_branch}",
"--limit", "1",
"--json", "number",
"--jq", ".[0].number",
"--jq", ".[].number",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works better without 0

"--repo", f"{self.github_repo}"
])
.stdout()
Expand Down