Skip to content
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

Ci/build and tests #19

Merged
merged 7 commits into from
Dec 29, 2022
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
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@spoukke
@Alan-pad
63 changes: 63 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Continuous Integration

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Golang
uses: actions/setup-go@v3
with:
go-version: "1.19"
- name: Run tests
run: make test

build-and-push:
name: Build & Push
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Golang
uses: actions/setup-go@v3
with:
go-version: "1.19"

# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2

- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get version from main branch
if: ${{ github.event_name == 'push' }}
run: |
echo "VERSION=${{ github.sha }}" >> $GITHUB_ENV
- name: Get version from pull request
if: ${{ github.event_name == 'pull_request' }}
run: |
echo "VERSION=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV

- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ env.VERSION }}
2 changes: 1 addition & 1 deletion controllers/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func defaultPodSpec(layer *configv1alpha1.TerraformLayer, repository *configv1al
Containers: []corev1.Container{
{
Name: "runner",
Image: fmt.Sprintf("eu.gcr.io/padok-playground/burrito:%s", "alpha"),
Image: fmt.Sprintf("ghcr.io/padok-team/burrito:%s", "latest"),
WorkingDir: "/repository",
Args: []string{"runner", "start"},
VolumeMounts: []corev1.VolumeMount{
Expand Down