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

Merge pull request #13 from dfinity/testci #14

Merged
merged 5 commits into from
Jul 31, 2024
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
81 changes: 78 additions & 3 deletions .github/workflows/airflow-containers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,89 @@ on:
paths:
- airflow-content-syncer/**
- airflow-customized/**
- .github/**
pull_request:
paths:
- airflow-content-syncer/**
- airflow-customized/**
- .github/**

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
airflow-content-syncer:
build-airflow-content-syncer:
name: Build Airflow content syncer container
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
# This image is based on ubuntu:20.04
steps:
- uses: actions/checkout@v4

- uses: docker/metadata-action@v5
id: metadata
with:
images: ghcr.io/${{ github.repository }}/airflow-content-syncer
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha,format=long

- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: int128/kaniko-action@v1
name: Create airflow-content-syncer container
with:
push: false
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
cache: false
cache-repository: ghcr.io/${{ github.repository }}/cache
context: airflow-content-syncer
build-airflow-customized:
name: Build customized Airflow container
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
# This image is based on ubuntu:20.04
steps:
- uses: actions/checkout@v4

- uses: docker/metadata-action@v5
id: metadata
with:
images: ghcr.io/${{ github.repository }}/airflow-customized
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha,format=long

- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: int128/kaniko-action@v1
name: Create airflow-customized container
with:
push: false
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
cache: false
cache-repository: ghcr.io/${{ github.repository }}/cache
context: airflow-customized
publish-airflow-content-syncer:
name: Publish Airflow content syncer container
if: github.event_name == 'push' and github.ref == 'refs/heads/main'
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
# This image is based on ubuntu:20.04
steps:
Expand Down Expand Up @@ -46,8 +120,9 @@ jobs:
cache: false
cache-repository: ghcr.io/${{ github.repository }}/cache
context: airflow-content-syncer
airflow-customized:
publish-airflow-customized:
name: Publish customized Airflow container
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
# This image is based on ubuntu:20.04
steps:
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/rollout-dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,34 @@ concurrency:

jobs:
test-backend:
name: Run tests for the backend
name: Test backend
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- run: mv -f rollout-dashboard/server/*
- run: mv -f rollout-dashboard/server/* .
- uses: actions-rs/cargo@v1
with:
command: test
test-frontend:
if: github.event_name == 'pull_request'
name: Run tests for the frontend
name: Test frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"
- run: mv -f rollout-dashboard/frontend/*
- run: mv -f rollout-dashboard/frontend/* .
- run: npm ci
- run: npm run build --if-present
- run: npm test
- run: npm run build
- run: npm run check
build-rollout-dashboard-container:
name: Publish rollout dashboard container
name: Build rollout dashboard container
if: github.event_name == 'pull_request'
needs: [test-backend, test-frontend]
runs-on: ubuntu-latest
Expand Down
127 changes: 67 additions & 60 deletions rollout-dashboard/frontend/src/App.svelte
Original file line number Diff line number Diff line change
@@ -1,78 +1,85 @@
<script lang="ts">
import { onMount } from 'svelte';
import url from './lib/url.js';
import { rollout_query } from './lib/stores.ts';
import Rollout from './lib/Rollout.svelte';
import { writable } from 'svelte/store'
import { ButtonGroup, Button } from 'flowbite-svelte';
import { onMount } from "svelte";
import url from "./lib/url.js";
import { type RolloutResult, rollout_query } from "./lib/stores";
import Rollout from "./lib/Rollout.svelte";
import { writable } from "svelte/store";
import { ButtonGroup, Button } from "flowbite-svelte";

let my_rollout_query = writable({rollouts: [], error: "loading"});
onMount( async() => {
my_rollout_query = rollout_query()
})
let my_rollout_query = writable({
rollouts: [],
error: "loading",
} as RolloutResult);
onMount(async () => {
my_rollout_query = rollout_query();
});
</script>

<nav>
<ButtonGroup class="*:!ring-primary-700">
<Button href="#active">Active</Button>
<Button href="#complete">Complete</Button>
<Button href="#failed">Failed</Button>
<Button href="#all">All</Button>
</ButtonGroup>
<ButtonGroup class="*:!ring-primary-700">
<Button href="#active">Active</Button>
<Button href="#complete">Complete</Button>
<Button href="#failed">Failed</Button>
<Button href="#all">All</Button>
</ButtonGroup>
</nav>

{#if $my_rollout_query.error && $my_rollout_query.error !== "loading"}
<!-- note use of me-3 in svg icon to ensure icon actually shows not too stuck to the text -->
<div class="flex items-center p-4 mb-4 text-sm text-red-800 border border-red-300 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400 dark:border-red-800" role="alert">
<svg class="w-6 h-6 me-3 text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
<path fill-rule="evenodd" d="M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Zm11-4a1 1 0 1 0-2 0v5a1 1 0 1 0 2 0V8Zm-1 7a1 1 0 1 0 0 2h.01a1 1 0 1 0 0-2H12Z" clip-rule="evenodd"/>
</svg>
<span class="sr-only">Error</span>
<div>
<span class="font-medium">Cannot retrieve rollout data:</span> {$my_rollout_query.error}
<!-- note use of me-3 in svg icon to ensure icon actually shows not too stuck to the text -->
<div
class="flex items-center p-4 mb-4 text-sm text-red-800 border border-red-300 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400 dark:border-red-800"
role="alert"
>
<svg
class="w-6 h-6 me-3 text-gray-800 dark:text-white"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
fill="currentColor"
viewBox="0 0 24 24"
>
<path
fill-rule="evenodd"
d="M2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Zm11-4a1 1 0 1 0-2 0v5a1 1 0 1 0 2 0V8Zm-1 7a1 1 0 1 0 0 2h.01a1 1 0 1 0 0-2H12Z"
clip-rule="evenodd"
/>
</svg>
<span class="sr-only">Error</span>
<div>
<span class="font-medium">Cannot retrieve rollout data:</span>
{$my_rollout_query.error}
</div>
</div>
</div>
{/if}

{#if $my_rollout_query.error === "loading"}
<div class="flex items-center justify-center w-56 h-56 border border-gray-200 rounded-lg bg-gray-50 dark:bg-gray-800 dark:border-gray-700" style="align-self: center">
<div
class="flex items-center justify-center w-56 h-56 border border-gray-200 rounded-lg bg-gray-50 dark:bg-gray-800 dark:border-gray-700"
style="align-self: center"
>
<div role="status">
<svg aria-hidden="true" class="w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/><path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/></svg>
<span class="sr-only">Loading...</span>
<svg
aria-hidden="true"
class="w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600"
viewBox="0 0 100 101"
fill="none"
xmlns="http://www.w3.org/2000/svg"
><path
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
fill="currentColor"
/><path
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
fill="currentFill"
/></svg
>
<span class="sr-only">Loading...</span>
</div>
</div>
</div>
{/if}

{#each $my_rollout_query.rollouts as rollout}
{#if
(
(
$url.hash === ''
||
$url.hash === '#active'
) && (
rollout.state !== "complete"
&&
rollout.state !== "failed"
)
)
||
(
$url.hash === '#complete'
&&
rollout.state === "complete"
)
||
(
$url.hash === '#failed'
&&
rollout.state === "failed"
)
||
(
$url.hash === '#all'
)
}
<Rollout rollout={rollout}/>
{/if}
{#if (($url.hash === "" || $url.hash === "#active") && rollout.state !== "complete" && rollout.state !== "failed") || ($url.hash === "#complete" && rollout.state === "complete") || ($url.hash === "#failed" && rollout.state === "failed") || $url.hash === "#all"}
<Rollout {rollout} />
{/if}
{/each}
36 changes: 6 additions & 30 deletions rollout-dashboard/frontend/src/lib/Batch.svelte
Original file line number Diff line number Diff line change
@@ -1,40 +1,18 @@
<script>
<script lang="ts">
import Time from "svelte-time";
export let batch_num;
export let batch;
var subnet_rollout_states = {
pending: { icon: "🕐", name: "Pending" },
waiting: { icon: "⌛", name: "Waiting" },
proposing: { icon: "📝", name: "Proposing update to new revision" },
waiting_for_election: {
icon: "🗳️",
name: "Waiting for revision election",
},
waiting_for_adoption: {
icon: "⚡",
name: "Waiting for revision adoption",
},
waiting_for_alerts_gone: {
icon: "📢",
name: "Waiting until no more alerts",
},
complete: { icon: "✅", name: "Complete" },
skipped: { icon: "⏩", name: "Skipped" },
error: { icon: "❌", name: "Error" },
predecessor_failed: { icon: "❌", name: "Predecessor failed" },
unknown: { icon: "❓", name: "Does not appear in Airflow" },
};
import { type Batch, batchStateName, batchStateIcon } from "./types";
export let batch_num: String;
export let batch: Batch;
</script>

<li class="rounded-lg border batch batch-{batch_num}">
{#each batch.subnets as subnet}
<ul>
<li class="subnet">
<div class="subnet_state_icon tooltip">
{subnet_rollout_states[subnet.state].icon}<span
{batchStateIcon(subnet.state)}<span
class="subnet_state tooltiptext"
>{subnet_rollout_states[subnet.state]
.name}{#if subnet.comment}<br
>{batchStateName(subnet.state)}{#if subnet.comment}<br
/>{subnet.comment}{/if}</span
>
</div>
Expand Down Expand Up @@ -84,7 +62,6 @@
margin: 0;
padding: 0;
list-style-type: none;
dborder: 1px solid green;
}
li.batch {
background-color: #e4e4e4;
Expand All @@ -93,7 +70,6 @@
li.subnet {
padding-left: 0;
margin-left: 0;
dborder: 1px solid orange;
}
.subnet_id {
width: 4rem;
Expand Down
Loading
Loading