Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
lukepereira committed Jan 5, 2024
2 parents 327c485 + d3edc73 commit c4f81b3
Show file tree
Hide file tree
Showing 374 changed files with 20,878 additions and 13,165 deletions.
9 changes: 0 additions & 9 deletions .argocd/README.md

This file was deleted.

48 changes: 0 additions & 48 deletions .argocd/appset.yml

This file was deleted.

4 changes: 0 additions & 4 deletions .argocd/preview/Chart.yaml

This file was deleted.

116 changes: 0 additions & 116 deletions .argocd/preview/templates/deployment.yaml

This file was deleted.

18 changes: 0 additions & 18 deletions .argocd/preview/templates/ingress.yml

This file was deleted.

12 changes: 0 additions & 12 deletions .argocd/preview/templates/service.yaml

This file was deleted.

14 changes: 14 additions & 0 deletions .github/scripts/collect_kubernetes_logs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

set -e

pods=$(kubectl get pods -l app=loculus -n loculus -o jsonpath='{.items[*].metadata.name}' || true)
for pod in $pods; do
containers=$(kubectl get pod "$pod" -n loculus -o jsonpath='{.spec.containers[*].name}' || true)
for container in $containers; do
mkdir "kubernetes_logs" -p
file="kubernetes_logs/$pod-$container.txt"
echo "Logs from $pod - $container:" >> "$file"
kubectl logs "$pod" -n loculus -c "$container" >> "$file" 2>/dev/null || true
done
done
14 changes: 0 additions & 14 deletions .github/scripts/wait_for_backend.sh

This file was deleted.

13 changes: 0 additions & 13 deletions .github/scripts/wait_for_frontend.sh

This file was deleted.

54 changes: 54 additions & 0 deletions .github/scripts/wait_for_pods_to_be_ready.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env python3

import json
import subprocess
import time


def main():
end_time = time.time() + 480

while True:
pods = get_pods()

if time.time() > end_time:
print("Aborting, timeout reached")
exit(1)

try:
if all_pods_are_ready(pods):
print("All pods are up and running!")
break
except KeyError as e:
print("KeyError:", e, "continuing...")

print("Sleeping for 10 seconds...")
time.sleep(10)


def get_pods():
cmd = ['kubectl', 'get', 'pods', '-l', 'app=loculus', '-n', 'loculus', '-o', 'json']
result = subprocess.run(cmd, capture_output=True, text=True)
return json.loads(result.stdout)['items']


def all_pods_are_ready(pods):
for pod in pods:
print("Status of:", pod['metadata']['name'], "-", pod['status']['phase'])
if pod['status']['phase'] == 'Succeeded':
continue
if has_container_that_is_not_ready(pod):
return False
return True


def has_container_that_is_not_ready(pod):
for container_status in pod['status']['containerStatuses']:
if container_status['ready'] is False:
print(container_status['name'], "is not ready")
return True
return False


if __name__ == "__main__":
main()
32 changes: 21 additions & 11 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 20
uses: actions/setup-java@v3
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '20'
java-version: '21'
distribution: 'adopt'
- name: Execute Tests
uses: gradle/gradle-build-action@v2
Expand All @@ -44,10 +44,10 @@ jobs:
checks: read
steps:
- uses: actions/checkout@v4
- name: Set up JDK 20
uses: actions/setup-java@v3
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '20'
java-version: '21'
distribution: 'adopt'

- name: Login to GitHub Container Registry
Expand All @@ -65,17 +65,27 @@ jobs:
tags: |
type=ref,event=branch,enable=${{ github.ref != 'refs/heads/main' }}
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=sha,prefix=commit-
- name: Extract Docker Tags
id: extractTag
run: |
FIRST_TAG=$(echo "${{ steps.dockerMetadata.outputs.tags }}" | head -n 1)
echo "::set-output name=firstTag::$FIRST_TAG"
SECOND_TAG=$(echo "${{ steps.dockerMetadata.outputs.tags }}" | head -n 2 | tail -n 1)
echo "::set-output name=secondTag::$SECOND_TAG"
- name: Build Docker Image For Branch
uses: gradle/gradle-build-action@v2
env:
USER: ${{ github.actor }}
TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
arguments: bootBuildImage --imageName=${{ steps.dockerMetadata.outputs.tags }}
arguments: bootBuildImage --imageName=${{steps.extractTag.outputs.firstTag }}
build-root-directory: ./backend

- name: Push Docker Image For Branch
run: docker push ${{ steps.dockerMetadata.outputs.tags }}


- name: Tag With SHA tag
run: docker tag ${{ steps.extractTag.outputs.firstTag }} ${{ steps.extractTag.outputs.secondTag }}
- name: Push 1st Docker Image
run: docker push ${{ steps.extractTag.outputs.firstTag }}
- name: Push 2nd Docker Image
run: docker push ${{ steps.extractTag.outputs.secondTag }}
Loading

0 comments on commit c4f81b3

Please sign in to comment.