Skip to content

Commit

Permalink
Merge pull request #395 from CameronRP/update-test
Browse files Browse the repository at this point in the history
Update test
  • Loading branch information
CameronRP authored Oct 9, 2024
2 parents ea0fa1b + afaf098 commit c5487f9
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 62 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/aggregate-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,22 @@ const versionsAreEqual = (prev, next) => {
}
return true;
};
const latestCommitDate = async (branch) => {
try {
console.log("Getting latest commit date for ", branch);
const response = await fetch(`https://api.github.com/repos/TheCacophonyProject/saltops/commits?sha=${branch}&per_page=1`);
if (!response.ok) {
throw new Error(`Response status: ${response.status}`);
}

const commitJson = await response.json();
const commitDate = commitJson[0]["commit"]["author"]["date"]
return commitDate
} catch (error) {
console.error("Error getting latest commit date ",error.message);
}
return "";
}
(async function () {
const versionData = {};
console.log(process.cwd());
Expand All @@ -77,11 +93,13 @@ const versionsAreEqual = (prev, next) => {
// For each branch:
versionData[branch] = {};
process.chdir(`./${branch}`);
const commitDate = await latestCommitDate(branch)
console.log("Got commit date",commitDate);
for (const model of models) {
// For each camera model:
process.chdir(`./${model}`);
const slsFiles = getFilesWithExtension(".", "sls");
versionData[branch][model] = {};
versionData[branch][model] = {"commitDate":commitDate};
for (const path of slsFiles) {
const data = fs.readFileSync(path, "utf8");
try {
Expand Down
44 changes: 0 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,3 @@ The `prod` branch is updated through pulling the latest changes from `test`. Thi
- `git checkout -b update-prod origin/prod`
- `git merge origin/test`
- Push changes to personal fork and make a PR on GitHub


#### Version information (_Updated 25/6/2021, 4:46:56 PM_):
____
#### Branch `prod`
* attiny-controller: 3.5.0
* audiobait: 3.0.1
* go-config: 1.3.1
* device-register: 1.3.0
* event-reporter: 3.3.0
* management-interface: 1.9.0
* modemd: 1.2.2
* rtc-utils: 1.3.0
* salt-updater: 0.4.0
* thermal-recorder: 2.13.0
* thermal-uploader: 2.2.0

[Release notes](https://docs.cacophony.org.nz/home/release-notes-2020)
#### Branch `test`
* attiny-controller: 3.5.0
* audiobait: 3.0.1
* go-config: 1.3.1
* device-register: 1.3.0
* event-reporter: 3.3.0
* management-interface: 1.9.0
* modemd: 1.2.2
* rtc-utils: 1.3.0
* salt-updater: 0.4.0
* thermal-recorder: 2.13.0
* thermal-uploader: 2.2.0
#### Branch `dev`
* attiny-controller: 3.5.0
* audiobait: 3.0.1
* go-config: 1.6.4
* device-register: 1.4.0
* event-reporter: 3.3.0
* management-interface: 1.9.0
* modemd: 1.2.3
* rtc-utils: 1.3.0
* salt-updater: 0.4.0
* thermal-recorder: 2.14.0
* thermal-uploader: 2.3.0

[Release notes](https://docs.cacophony.org.nz/home/release-notes-2)
46 changes: 40 additions & 6 deletions tc2/basics/new-image-tidy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,62 @@ fi
# Script to tidy up the SD card to make it ready for making a new SD card image.
rm -r /var/spool/cptv/*

rm /etc/cacophony/config.toml
touch /etc/cacophony/config.toml

# Set location to Chch, this is so tc2-agent can run.
sudo cacophony-config -w location.latitude=-43.5333 location.longitude=172.6333

# Remove log files
rm -r /var/log/*
journalctl --vacuum-size=1

# Remove bash history
rm /home/pi/.bash_history

# Remove all NM connections apart from bushnet
find /etc/NetworkManager/system-connections/ -maxdepth 1 -type f ! -name 'bushnet.nmconnection' -exec rm {} +

# Remove events from the database
systemctl stop event-reporter
rm /var/lib/event-reporter.db

# Set hostname to "tc2-image"
hostnamectl set-hostname tc2-image

# Remove local salt data
systemctl stop salt-minion
rm -r /srv/salt/
rm -r /etc/salt/pki/
rm /etc/salt/minion_id

# Set to default salt grains
echo "environment: tc2-prod" > /etc/salt/grains

##### Delete files in /etc/cacophony apart from the ones in FILES_TO_KEEP
FILES_TO_KEEP=(
"salt-states-count"
"attiny-firmware.hex"
"rp2040-firmware.elf"
"salt-nodegroup"
)

# Create an associative array for quick lookup
declare -A KEEP_FILES_MAP
for file in "${FILES_TO_KEEP[@]}"; do
KEEP_FILES_MAP["$file"]=1
done

# Iterate over all files in the target directory
for file in /etc/cacophony/*; do
filename=$(basename "$file")

# Check if the file is in the keep list
if [[ ! ${KEEP_FILES_MAP[$filename]+_} ]]; then
echo "Deleting: $file"
rm -f "$file"
fi
done

# Create config file
touch /etc/cacophony/config.toml

# Set location to Chch, this is so tc2-agent can run.
cacophony-config -w location.latitude=-43.5333 location.longitude=172.6333

# Set image datetime
date +"%Y-%m-%d %H:%M:%S" > /etc/cacophony/image-datetime
2 changes: 1 addition & 1 deletion tc2/device-register/init.sls
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
device-register-pkg:
cacophony.pkg_installed_from_github:
- name: device-register
- version: "1.5.4"
- version: "1.6.0"
- branch: master

/etc/systemd/system/device-register.service.d:
Expand Down
3 changes: 2 additions & 1 deletion tc2/management-interface/init.sls
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
management-interface-pkg:
cacophony.pkg_installed_from_github:
- name: management-interface
- version: "1.31.1-tc2"
- version: "1.33.1-tc2"
- architecture: "arm64"
- branch: tc2

managementd-service:
Expand Down
2 changes: 1 addition & 1 deletion tc2/modemd/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ stop_modem_manager:
modemd-pkg:
cacophony.pkg_installed_from_github:
- name: modemd
- version: "1.10.1-tc2"
- version: "1.11.0-tc2"
- branch: "tc2"

modemd:
Expand Down
2 changes: 1 addition & 1 deletion tc2/rpi-net-manager/init.sls
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
rpi-net-manager-pkg:
cacophony.pkg_installed_from_github:
- name: rpi-net-manager
- version: "0.5.4"
- version: "0.5.5"
- architecture: "arm64"

rpi-net-manager-service:
Expand Down
2 changes: 1 addition & 1 deletion tc2/tc2-agent/init.sls
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
tc2-agent-pkg:
cacophony.pkg_installed_from_github:
- name: tc2-agent
- version: "0.3.14"
- version: "0.4.0"
- architecture: "arm64"
- branch: "main"

Expand Down
10 changes: 5 additions & 5 deletions tc2/tc2-hat-controller/init.sls
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
tc2-hat-controller-pkg:
cacophony.pkg_installed_from_github:
- name: tc2-hat-controller
- version: "0.11.1"
- version: "0.13.1"
- architecture: "arm64"
- branch: "main"

Expand All @@ -25,7 +25,7 @@ tc2-hat-rtc-service:
- name: tc2-hat-rtc
- enable: True

#tc2-hat-uart-service:
# service.running:
# - name: tc2-hat-uart
# - enable: True
tc2-hat-comms-service:
service.running:
- name: tc2-hat-comms
- enable: True
3 changes: 2 additions & 1 deletion tc2/thermal-uploader/init.sls
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
thermal-uploader-pkg:
cacophony.pkg_installed_from_github:
- name: thermal-uploader
- version: "2.6.3"
- version: "2.7.1"
- architecture: "arm64"
- branch: master

thermal-uploader-service:
Expand Down

0 comments on commit c5487f9

Please sign in to comment.