Skip to content

Commit

Permalink
Merge pull request #116 from qJake/v1.1-prep
Browse files Browse the repository at this point in the history
v1.1 Final changes
  • Loading branch information
qJake committed Jan 31, 2021
2 parents 8c1f8dd + ed3cd0d commit 11ceecd
Show file tree
Hide file tree
Showing 14 changed files with 109 additions and 454 deletions.
55 changes: 10 additions & 45 deletions Docker/BuildHaccContainers.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$version = '1.0.26'
$version = '1.1.0'

function Test-ExitCode ([int] $Expected = 0)
{
Expand All @@ -8,23 +8,18 @@ function Test-ExitCode ([int] $Expected = 0)
}
}

$sw = [System.Diagnostics.Stopwatch]::StartNew()
Write-Host "Started: $((Get-Date))"

$prgAct = 'Building HACC Docker images...'
$prgStat = 'Building'

# Build Raw Images

Write-Progress -Activity $prgAct -Status $prgStat -PercentComplete 1 -CurrentOperation 'Debian-ARM32v7'
docker build --build-arg TAG=$version --no-cache -t qjake/hacc:$version-linux-debian-arm32v7 -f linux-debian-arm32v7/Dockerfile . ; Test-ExitCode

Write-Progress -Activity $prgAct -Status $prgStat -PercentComplete 50 -CurrentOperation 'Debian-ARM64v8'
docker build --build-arg TAG=$version --no-cache -t qjake/hacc:$version-linux-debian-arm64v8 -f linux-debian-arm64v8/Dockerfile . ; Test-ExitCode

Write-Progress -Activity $prgAct -Status $prgStat -PercentComplete 70 -CurrentOperation 'Ubuntu-AMD64'
Write-Progress -Activity $prgAct -Status $prgStat -PercentComplete 33 -CurrentOperation 'Ubuntu-AMD64'
docker build --build-arg TAG=$version --no-cache -t qjake/hacc:$version-linux-ubuntu-amd64 -f linux-ubuntu-amd64/Dockerfile . ; Test-ExitCode

Write-Progress -Activity $prgAct -Status $prgStat -PercentComplete 80 -CurrentOperation 'Debian-AMD64'
Write-Progress -Activity $prgAct -Status $prgStat -PercentComplete 66 -CurrentOperation 'Debian-AMD64'
docker build --build-arg TAG=$version --no-cache -t qjake/hacc:$version-linux-debian-amd64 -f linux-debian-amd64/Dockerfile . ; Test-ExitCode

Write-Progress -Activity $prgAct -Status $prgStat -PercentComplete 90 -CurrentOperation 'Alpine-AMD64'
Expand All @@ -35,26 +30,10 @@ Write-Progress -Activity $prgAct -Completed

# Tag Latest Specific

docker tag qjake/hacc:$version-linux-debian-arm64v8 qjake/hacc:latest-linux-debian-arm64v8
docker tag qjake/hacc:$version-linux-ubuntu-amd64 qjake/hacc:latest-linux-ubuntu-amd64
docker tag qjake/hacc:$version-linux-alpine-amd64 qjake/hacc:latest-linux-alpine-amd64
docker tag qjake/hacc:$version-linux-debian-arm32v7 qjake/hacc:latest-linux-debian-arm32v7
docker tag qjake/hacc:$version-linux-debian-amd64 qjake/hacc:latest-linux-debian-amd64

# Re-tag Hassio Architecture Tags

docker tag qjake/hacc:$version-linux-debian-arm64v8 qjake/hacc-hassio-aarch64:$version
docker tag qjake/hacc:$version-linux-alpine-amd64 qjake/hacc-hassio-amd64:$version
docker tag qjake/hacc:$version-linux-debian-arm32v7 qjake/hacc-hassio-armhf:$version
docker tag qjake/hacc:$version-linux-debian-arm32v7 qjake/hacc-hassio-armv7:$version

# Tag Hassio Latest

docker tag qjake/hacc-hassio-aarch64:$version qjake/hacc-hassio-aarch64:latest
docker tag qjake/hacc-hassio-amd64:$version qjake/hacc-hassio-amd64:latest
docker tag qjake/hacc-hassio-armhf:$version qjake/hacc-hassio-armhf:latest
docker tag qjake/hacc-hassio-armv7:$version qjake/hacc-hassio-armv7:latest

# Tag main version and latest

docker tag qjake/hacc:$version-linux-debian-amd64 qjake/hacc:$version
Expand All @@ -67,41 +46,27 @@ $prgAct = 'Pushing Docker images...'
$prgStat = 'Pushing'

# The first 5 take awhile, the others are just copies and go faster.
Write-Progress -Activity $prgAct -Status $prgStat -PercentComplete 15 -CurrentOperation 'Alpine-AMD64'
Write-Progress -Activity $prgAct -Status $prgStat -PercentComplete 33 -CurrentOperation 'Alpine-AMD64'
docker push qjake/hacc:$version-linux-alpine-amd64

Write-Progress -Activity $prgAct -Status $prgStat -PercentComplete 30 -CurrentOperation 'Debian-AMD64'
Write-Progress -Activity $prgAct -Status $prgStat -PercentComplete 66 -CurrentOperation 'Debian-AMD64'
docker push qjake/hacc:$version-linux-debian-amd64

Write-Progress -Activity $prgAct -Status $prgStat -PercentComplete 50 -CurrentOperation 'Ubuntu-AMD64'
Write-Progress -Activity $prgAct -Status $prgStat -PercentComplete 99 -CurrentOperation 'Ubuntu-AMD64'
docker push qjake/hacc:$version-linux-ubuntu-amd64

Write-Progress -Activity $prgAct -Status $prgStat -PercentComplete 75 -CurrentOperation 'Debian-ARM32v7'
docker push qjake/hacc:$version-linux-debian-arm32v7

Write-Progress -Activity $prgAct -Status $prgStat -PercentComplete 90 -CurrentOperation 'Debian-ARM64v8'
docker push qjake/hacc:$version-linux-debian-arm64v8

Write-Progress -Activity $prgAct -Completed

docker push qjake/hacc:latest-linux-alpine-amd64
docker push qjake/hacc:latest-linux-debian-amd64
docker push qjake/hacc:latest-linux-ubuntu-amd64
docker push qjake/hacc:latest-linux-debian-arm32v7
docker push qjake/hacc:latest-linux-debian-arm64v8
docker push qjake/hacc-hassio-aarch64:$version
docker push qjake/hacc-hassio-amd64:$version
docker push qjake/hacc-hassio-armhf:$version
docker push qjake/hacc-hassio-armv7:$version
docker push qjake/hacc-hassio-aarch64:latest
docker push qjake/hacc-hassio-amd64:latest
docker push qjake/hacc-hassio-armhf:latest
docker push qjake/hacc-hassio-armv7:latest
docker push qjake/hacc:$version
docker push qjake/hacc:latest

Write-Host "Cleaning up, this may take a moment..."
# Clean up... because you can get a "no space left on disk" error on some containers otherwise
docker image prune --force

Write-Host "Completed: $((Get-Date))"
Write-Host "Completed: $((Get-Date))"
$sw.Stop()
Write-Host "Took $($sw.Elapsed.Minutes) min(s) $($sw.Elapsed.Seconds) sec(s)."
47 changes: 0 additions & 47 deletions Docker/PrepareArmImage.ps1

This file was deleted.

41 changes: 0 additions & 41 deletions Docker/linux-debian-arm32v7/Dockerfile

This file was deleted.

70 changes: 0 additions & 70 deletions Docker/linux-debian-arm64v8/Dockerfile

This file was deleted.

5 changes: 3 additions & 2 deletions HADotNet.CommandCenter/Controllers/AdminController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public async Task<IActionResult> Settings([FromForm] SystemSettings newSettings)
{
newSettings ??= new SystemSettings();
newSettings.BaseUri = newSettings.BaseUri?.TrimEnd('/');
newSettings.AccessToken = newSettings.AccessToken?.Trim();
await ConfigStore.ManipulateConfig(c => c.Settings = newSettings);

ClientFactory.Reset();
Expand Down Expand Up @@ -205,7 +206,7 @@ public async Task<IActionResult> ExportTheme()

Logger.LogInformation("Exported theme settings.");

return Ok();
return new EmptyResult();
}

[HttpPost]
Expand Down Expand Up @@ -277,7 +278,7 @@ public async Task<IActionResult> ExportConfig()

Logger.LogInformation($"Exported system configuration to downloaded file '{filename}'.");

return Ok();
return new EmptyResult();
}

[HttpGet]
Expand Down
19 changes: 3 additions & 16 deletions HADotNet.CommandCenter/HADotNet.CommandCenter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifiers>win10;alpine.3.10-x64;debian.10-arm</RuntimeIdentifiers>
<RuntimeIdentifiers>win10;alpine.3.10-x64</RuntimeIdentifiers>
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<AssemblyVersion>1.0.26.0</AssemblyVersion>
<FileVersion>1.0.26.0</FileVersion>
<AssemblyVersion>1.1.0.0</AssemblyVersion>
<FileVersion>1.1.0.0</FileVersion>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Deterministic>false</Deterministic>
Expand All @@ -25,11 +25,6 @@
<Content Include="wwwroot/**/*.ts" CopyToPublishDirectory="Never" />
</ItemGroup>

<ItemGroup>
<None Remove="HADotNet.CommandCenter-armhf.tar" />
<None Remove="HADotNet.CommandCenter-armhf.tar.gz" />
</ItemGroup>

<ItemGroup>
<None Include="bundleconfig.json" />
<None Include="compilerconfig.json" />
Expand Down Expand Up @@ -78,12 +73,4 @@
<OutputPath>bin\Release\</OutputPath>
</PropertyGroup>

<Target Name="PreBuild" BeforeTargets="PreBuildEvent" Condition="'$(Configuration)' == 'VersionBuild'">
<Exec Command="powershell -nologo -noprofile -command rm -force -recurse $(TargetDir)..\*" />
</Target>

<Target Name="PostBuild" AfterTargets="AfterPublish" Condition="'$(Configuration)' == 'VersionBuild'">
<Exec Command="powershell -nologo -noprofile -command write-host 'Building .tar.gz release...'; cd $(ProjectDir); Copy-Item .\bin\Release\netcoreapp3.1\publish\wwwroot .\bin\Release\netcoreapp3.1\debian.10-arm\ -Recurse -Force; cd .\bin\Release\netcoreapp3.1\debian.10-arm\; 7z a -ttar HADotNet.CommandCenter-armhf.tar *; 7z a -tgzip HADotNet.CommandCenter-armhf.tar.gz HADotNet.CommandCenter-armhf.tar; Copy-Item HADotNet.CommandCenter-armhf.tar.gz ../../; " />
</Target>

</Project>
2 changes: 1 addition & 1 deletion HADotNet.CommandCenter/Hubs/TileHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private async Task ProcessOverrides(BaseTile tile)
// via the "inside" supervisor API, only the "external" fully-qualified
// API endpoint.
var config = await ConfigStore.GetConfigAsync();
var calClient = new CalendarClient(new Uri(config.Settings.OverrideAssetUri), config.Settings.AccessToken);
var calClient = new CalendarClient(new Uri(!string.IsNullOrWhiteSpace(config.Settings?.OverrideAssetUri) ? config.Settings.OverrideAssetUri : config.Settings.BaseUri), config.Settings.AccessToken);

var state = await StatesClient.GetState(ct.EntityId);
var calItems = await calClient.GetEvents(ct.EntityId);
Expand Down

0 comments on commit 11ceecd

Please sign in to comment.