Skip to content

Commit

Permalink
Merge branch 'main' into 361-introduction-visionnode
Browse files Browse the repository at this point in the history
  • Loading branch information
asamluka authored Nov 5, 2024
2 parents 3569081 + a4de11c commit 168774e
Show file tree
Hide file tree
Showing 7 changed files with 227 additions and 82 deletions.
73 changes: 48 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
jobs:
build-and-push-image:
name: Build and push image
runs-on: self-hosted
runs-on: [self-hosted, build]
outputs:
version: ${{ steps.build.version.outputs.version }}
permissions:
Expand All @@ -35,22 +35,25 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Cache Docker layers
uses: actions/cache@v4
with:
path: |
/tmp/.buildx-cache/cache/test
/tmp/.buildx-cache/cache/latest
/tmp/.buildx-cache/cache-new/test
/tmp/.buildx-cache/cache-new/latest
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create cache directory
run: |
mkdir -p ./.buildx-cache/cache
mkdir ./.buildx-cache/cache-new
mkdir ./.buildx-cache/cache/test
mkdir ./.buildx-cache/cache/latest
mkdir ./.buildx-cache/cache-new/test
mkdir ./.buildx-cache/cache-new/latest
- name: Test build
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v3
Expand All @@ -59,8 +62,8 @@ jobs:
file: ./build/docker/agent/Dockerfile
load: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}:test
cache-from: type=local,src=./.buildx-cache/cache/test/
cache-to: type=local,dest=./.buildx-cache/cache-new/test/,mode=max
cache-from: type=local,src=/tmp/.buildx-cache/cache/test/
cache-to: type=local,dest=/tmp/.buildx-cache/cache-new/test/,mode=max
build-args: |
USERNAME=paf
USER_UID=1000
Expand All @@ -76,31 +79,51 @@ jobs:
push: true
# tag 'latest' and version on push to main, otherwise use the commit hash
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
cache-from: type=local,src=./.buildx-cache/cache/latest/
cache-to: type=local,dest=./.buildx-cache/cache-new/latest/,mode=max
cache-from: type=local,src=/tmp/.buildx-cache/cache/latest/
cache-to: type=local,dest=/tmp/.buildx-cache/cache-new/latest/,mode=max
build-args: |
USERNAME=paf
USER_UID=1000
USER_GID=1000
- name: Save PR ID
- name: Save pull request artifact
if: github.event_name == 'pull_request'
env:
PR_ID: ${{ github.event.number }}
run: |
mkdir -p ./pr
echo $PR_ID > ./pr/pr_id
mkdir -p ./artifact
printf '{
"is_pr": true,
"pr_id": $PR_ID
}' >> ./artifact/artifact.json
- name: Upload PR ID
if: github.event_name == 'pull_request'
- name: Save merge artifact
if: github.event_name != 'pull_request'
run: |
mkdir -p ./artifact
printf '{
"is_pr": false,
"pr_id": -1
}' >> ./artifact/artifact.json
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: pr_id
path: pr/
name: artifact
path: ./artifact/artifact.json
retention-days: 1

- name: Clean up cache
- name: Clean up PR cache
if: github.event_name == 'pull_request'
run: |
rm -rf /tmp/.buildx-cache/cache/test
mv /tmp/.buildx-cache/cache-new/test /tmp/.buildx-cache/cache/test
- name: Clean up merge cache
if: github.event_name != 'pull_request'
run: |
rm -rf ./.buildx-cache/cache/test
rm -rf ./.buildx-cache/cache/latest
mv ./.buildx-cache/cache-new ./.buildx-cache/cache
rm -rf /tmp/.buildx-cache/cache/latest
mv /tmp/.buildx-cache/cache-new/latest /tmp/.buildx-cache/cache/latest
- name: Prune all images older than 1 days from self-hosted runner
run: docker image prune -a -f --filter "until=24h"
74 changes: 28 additions & 46 deletions .github/workflows/drive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
drive:
runs-on: self-hosted
runs-on: [self-hosted, drive]
env:
AGENT_VERSION: latest
COMPOSE_FILE: ./build/docker-compose.cicd.yaml
Expand All @@ -20,47 +20,18 @@ jobs:
run: |
echo "AGENT_VERSION=${AGENT_VERSION}"
echo "COMPOSE_FILE=${COMPOSE_FILE}"
- name: 'Download artifact (PR ID)'
if: github.event_name == 'pull_request'
uses: actions/github-script@v6
- name: Download artifact
uses: actions/download-artifact@v4
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr_id"
})[0];
if (!matchArtifact) {
core.setFailed('No pr_id artifact found from the build workflow');
return;
}
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/pr_id.zip`, Buffer.from(download.data));
- name: 'Unzip artifact (PR ID)'
if: github.event_name == 'pull_request'
run: |
unzip pr_id.zip
- name: Check PR ID
if: github.event_name == 'pull_request'
name: artifact
- name: Return artifact JSON
id: return-artifact-json
uses: actions/github-script@v6
with:
script: |
let issue_number = fs.readFileSync('./pr_id');
if (!issue_number || isNaN(Number(issue_number))) {
core.setFailed(`Invalid PR ID: ${prIdContent}`);
return;
}
let fs = require('fs');
let data = JSON.parse(fs.readFileSync('${process.env.GITHUB_WORKSPACE}/artifacts.json'));
return data;
- name: Run docker-compose
run: |
Expand All @@ -73,12 +44,10 @@ jobs:
if: always()
run: docker compose down -v
# add rendered JSON as comment to the pull request
- name: Add simulation results as comment
if: github.event_name == 'pull_request'
- name: Create simulation results table
id: simulation-results
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# this script reads the simulation_results.json and creates a comment on the pull request with the results.
script: |
const fs = require('fs');
// read the simulation results
Expand All @@ -94,13 +63,26 @@ jobs:
let resultsTableDivider = `| --- | --- |`;
// add everything to the resultsTable
resultsTable = resultsTableHeader + '\n' + resultsTableDivider + '\n' + resultsTable.join('\n');
return resultsTable;
result-encoding: string
- name: Print simulation results
run: |
echo "Simulation results\n"
echo "${{ steps.simulation-results.outputs.result }}"
- name: Add simulation results as comment
if: ${{ steps.return-artifact-json.outputs.result.is_pr }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# this script reads the simulation_results.json and creates a comment on the pull request with the results.
script: |
let issue_number = Number(${{ steps.return-artifact-json.outputs.pr_id }});
// add the results as a comment to the pull request
let issue_number = Number(fs.readFileSync('./pr_id'));
github.rest.issues.createComment({
issue_number: issue_number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "## Simulation results\n" + resultsTable
body: "## Simulation results\n" + ${{ steps.simulation-results.outputs.result }}
});
- name: Prune all images older than 30 days from self-hosted runner
run: docker image prune -a --force --filter "until=720h"
- name: Prune all images older than 1 days from self-hosted runner
run: docker image prune -a --filter "until=24h"
21 changes: 10 additions & 11 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

This document provides an overview of the structure of the documentation.

- [PAF Documentation](#paf-documentation)
- [`general`](#general)
- [`development`](#development)
- [`research`](#research)
- [`examples`](#examples)
- [`perception`](#perception)
- [`planning`](#planning)
- [`acting`](#acting)
- [`assets`](#assets)
- [`dev_talks`](#dev_talks)
- [`general`](#general)
- [`development`](#development)
- [`research`](#research)
- [`examples`](#examples)
- [`perception`](#perception)
- [`planning`](#planning)
- [`acting`](#acting)
- [`assets`](#assets)
- [`dev_talks`](#dev_talks)

## `general`

Expand Down Expand Up @@ -47,4 +46,4 @@ The [`assets`](./assets/) folder contains mainly images that are used inside the

## `dev_talks`

The [`dev_talks`](./dev_talks/) folder contains the protocols of each sprint review and roles that the students fill during the project.
The [`dev_talks`](./dev_talks/README.md) folder contains the protocols of each sprint review and roles that the students fill during the project.
4 changes: 4 additions & 0 deletions doc/dev_talks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Dev Talks

- [PAF24](./paf24/README.md)
- [PAF23](./paf23/)
16 changes: 16 additions & 0 deletions doc/dev_talks/paf24/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# PAF24

**Summary**: The PAF24 folder contains documents that are relevant for the PAF24 group.

- [General Information](#general-information)
- [Notes for Sprints](#notes-for-sprints)

## General Information

- [Mermaid Gantt Chart](./mermaid_paf24.md)
- [Student Roles](./student_roles.md)
- [Joker Rules]

## Notes for Sprints

- [T03](./T03_2024-10-28.md)
63 changes: 63 additions & 0 deletions doc/dev_talks/paf24/joker_rules_paf24.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Joker Rules PAF24

**Purpose**: This document outlines the rules for using the Joker card in the PAF24 project.

- [1. Overview](#1-overview)
- [2. Using the Joker Card](#2-using-the-joker-card)
- [3. Special Circumstances](#3-special-circumstances)
- [3.1. Unable to Present Work Due to Scheduling Conflicts](#31-unable-to-present-work-due-to-scheduling-conflicts)
- [3.2. Illness or Emergency](#32-illness-or-emergency)

## 1. Overview

- **Project Duration**: October 2024 – March 2025
- The Joker card allows you to be excused from duties during specific periods, especially during the exam phase in February 2025.
- **Total Joker Allocation**:
- **Joker Card** Up to 4 weeks throughout the project.
- **Presentation Only Joker Card** Maximum of 2 uses.
- **When to Use**: The Joker card should be played if you are unable to present your work during a sprint review or if the amount of work completed is insufficient.
- The intention of the Joker card is to ensure you have the appropriate time to prepare your exam phase.

## 2. Using the Joker Card

To play the Joker card:

1. **Notify the Team and Chair**: Inform both the team and chair staff by posting in the `#joker` channel on our Discord server.
2. **Deadline**: Notify the team at least **7 days** before the sprint review.
3. **Example Post**:
- “I would like to play the Joker card for the sprint review on 2024-11-25.”
4. Your name and intent will be confirmed by the team and chair.

> [!NOTE] 2-week sprints require two Joker cards to cover the entire sprint.
## 3. Special Circumstances

### 3.1. Unable to Present Work Due to Scheduling Conflicts

- If you completed the sprint’s work but cannot present it, you have two options:
1. Play the standard Joker card.
2. Use a `Presentation Only Joker Card` by arranging for a teammate to present on your behalf.

- **Presentation Only Joker Card Details**:
- **Maximum Use**: Limited to two times throughout the project.
- **Requirements**:
- Notify the team and chair at least **7 days** before the sprint review.
- Submit a written summary of your work in the `#joker` Discord channel at least **1 day** before the review.
- Find a teammate who presents your work.

- **Written Summary Contents**:
- Overview of completed work.
- Key achievements.
- Lessons learned.
- Goals for the next sprint.

> [!CAUTION] Presentation Only Joker Card
> We encourage all team members to only present your teammates work if absolutely necessary.
> The work completed by your colleagues is their responsibility, and they should be the ones to present it.
> Furthermore, you should only present their work if you are familiar with it and can answer questions about it.
> Additionally, you should be confident that your team member has completed the work to a satisfactory standard.
### 3.2. Illness or Emergency

- **Illness**: If you cannot attend due to illness, provide a medical certificate to be excused from duties without using a Joker card.
- **Emergency**: Emergencies are evaluated individually.
Loading

0 comments on commit 168774e

Please sign in to comment.