forked from sbidoul/runboat
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: GitLab webhook support + Helm chart for K8s deployment #1
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
Open
dnplkndll
wants to merge
3
commits into
main
Choose a base branch
from
feat/gitlab-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,364
−54
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| name: Build, Test & Push | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, "feat/**"] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| env: | ||
| REGISTRY: us-central1-docker.pkg.dev | ||
| IMAGE: us-central1-docker.pkg.dev/kencove-prod/kencove-docker-repo/runboat | ||
| CHART_REPO: oci://us-central1-docker.pkg.dev/kencove-prod/kencove-docker-repo | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.13" | ||
| - name: Install dependencies | ||
| run: pip install -e ".[test]" | ||
| - name: Run tests | ||
| run: pytest tests/ -v | ||
|
|
||
| build-image: | ||
| needs: test | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - id: auth | ||
| uses: google-github-actions/auth@v2 | ||
| with: | ||
| workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | ||
| service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} | ||
|
|
||
| - uses: google-github-actions/setup-gcloud@v2 | ||
|
|
||
| - name: Configure Docker for GCP Artifact Registry | ||
| run: gcloud auth configure-docker us-central1-docker.pkg.dev --quiet | ||
|
|
||
| - name: Set image tags | ||
| id: tags | ||
| run: | | ||
| SHA_SHORT=$(echo "${{ github.sha }}" | cut -c1-12) | ||
| BRANCH=$(echo "${{ github.ref_name }}" | sed 's/[^a-zA-Z0-9._-]/-/g') | ||
| echo "sha_tag=${SHA_SHORT}" >> "$GITHUB_OUTPUT" | ||
| echo "branch_tag=${BRANCH}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Build Docker image | ||
| run: | | ||
| docker build \ | ||
| -t ${{ env.IMAGE }}:${{ steps.tags.outputs.sha_tag }} \ | ||
| -t ${{ env.IMAGE }}:${{ steps.tags.outputs.branch_tag }} \ | ||
| ${{ github.ref_name == 'main' && format('-t {0}:latest', env.IMAGE) || '' }} \ | ||
| . | ||
|
|
||
| - name: Push Docker image | ||
| run: | | ||
| docker push ${{ env.IMAGE }}:${{ steps.tags.outputs.sha_tag }} | ||
| docker push ${{ env.IMAGE }}:${{ steps.tags.outputs.branch_tag }} | ||
| ${{ github.ref_name == 'main' && format('docker push {0}:latest', env.IMAGE) || 'true' }} | ||
|
|
||
| push-chart: | ||
| needs: test | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'push' && github.ref_name == 'main' | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - id: auth | ||
| uses: google-github-actions/auth@v2 | ||
| with: | ||
| workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | ||
| service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} | ||
|
|
||
| - uses: google-github-actions/setup-gcloud@v2 | ||
|
|
||
| - name: Configure Helm for GCP Artifact Registry | ||
| run: gcloud auth print-access-token | helm registry login us-central1-docker.pkg.dev -u oauth2accesstoken --password-stdin | ||
|
|
||
| - name: Package and push Helm chart | ||
| run: | | ||
| helm package chart/ | ||
| helm push runboat-*.tgz ${{ env.CHART_REPO }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| apiVersion: v2 | ||
| name: runboat | ||
| description: Runboat - on-demand Odoo review environments on Kubernetes | ||
| type: application | ||
| version: 0.1.0 | ||
| appVersion: "0.2" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Docker images are pushed on pull_request events too — likely unintended.
The
build-imagejob has noifguard, so it runs on bothpushandpull_requesttriggers. This means PR builds will authenticate to GCP and push images to your production Artifact Registry, polluting it with throwaway PR images.Add an
ifcondition to restrict this job to push events, mirroring whatpush-chartalready does:Proposed fix
build-image: needs: test runs-on: ubuntu-latest + if: github.event_name == 'push' permissions: contents: read id-token: write📝 Committable suggestion
🤖 Prompt for AI Agents