Skip to content
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
19 changes: 3 additions & 16 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ jobs:

permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4
Expand All @@ -21,20 +20,8 @@ jobs:
with:
dotnet-version: 9.x

- name: Generate token
id: generate_token
uses: almacareer/dex-github-app-token@v1
with:
app_id: ${{ secrets.PRC_ACTIONS_INTERNAL_APPID }}
installation_id: ${{ secrets.PRC_ACTIONS_INTERNAL_INSTALLATION_ID }}
private_key: ${{ secrets.PRC_ACTIONS_INTERNAL_KEY }}

- name: Publish package
- name: Publish to NuGet.org
env:
PRIVATE_FEED_USER: ${{ github.repository_owner }}
PRIVATE_FEED_PASS: ${{ secrets.GITHUB_TOKEN }}
NUGET_SERVER_TOKEN: ${{ steps.generate_token.outputs.token }}
NUGET_SERVER_ORGANIZATION: ${{ github.repository_owner }}
NUGET_SERVER_REPOSITORY: "prc-nuget-server"
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
DOTNET_ROLL_FORWARD: latestMajor
run: ./build.sh -t publish
run: ./build.sh -t publish no-lint
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
PRIVATE_FEED_USER: ${{ github.repository_owner }}
PRIVATE_FEED_PASS: ${{ secrets.GITHUB_TOKEN }}
DOTNET_ROLL_FORWARD: latestMajor
run: ${{ matrix.os.run }} -t tests
run: ${{ matrix.os.run }} -t tests no-lint
7 changes: 5 additions & 2 deletions ApplicationStatus.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
<OutputType>Library</OutputType>
<PackageId>Alma.ApplicationStatus</PackageId>
<Version>6.1.0</Version>
<RepositoryUrl>https://github.com/almacareer/prc-fapplicationStatus.git</RepositoryUrl>
<PackageProjectUrl>https://github.com/almacareer/prc-fapplicationStatus</PackageProjectUrl>
<Authors>Almacareer</Authors>
<Description>Types for an common Application status representation.</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/alma-oss/fapplicationStatus.git</RepositoryUrl>
<PackageProjectUrl>https://github.com/alma-oss/fapplicationStatus</PackageProjectUrl>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

<!-- There is always Unreleased section on the top. Subsections (Add, Changed, Fix, Removed) should be Add as needed. -->
## Unreleased
- Move repository
- Remove `Nomad` fields

## 6.1.0 - 2025-03-17
- Update dependencies
Expand Down
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
### The MIT License (MIT) ###

Copyright (c) Alma Career Czechia s.r.o.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
25 changes: 5 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
Application Status
==================

> Types for an common Application status representation used in LMC.
[![NuGet](https://img.shields.io/nuget/v/Alma.ApplicationStatus.svg)](https://www.nuget.org/packages/Alma.ApplicationStatus)
[![NuGet Downloads](https://img.shields.io/nuget/dt/Alma.ApplicationStatus.svg)](https://www.nuget.org/packages/Alma.ApplicationStatus)
[![Tests](https://github.com/alma-oss/fapplicationStatus/actions/workflows/tests.yaml/badge.svg)](https://github.com/alma-oss/fapplicationStatus/actions/workflows/tests.yaml)

## Install

Add following into `paket.dependencies`
```
source https://nuget.pkg.github.com/almacareer/index.json username: "%PRIVATE_FEED_USER%" password: "%PRIVATE_FEED_PASS%"
# LMC Nuget dependencies:
nuget Alma.ApplicationStatus
```
> Types for an common Application status representation.
NOTE: For local development, you have to create ENV variables with your github personal access token.
```sh
export PRIVATE_FEED_USER='{GITHUB USERNANME}'
export PRIVATE_FEED_PASS='{TOKEN}' # with permissions: read:packages
```
## Install

Add following into `paket.references`
```
Expand All @@ -34,8 +25,6 @@ type CurrentApplication = {
Dependencies: Dependencies
ServiceStatus: ServiceStatus
LoggerFactory: ILoggerFactory
NomadJobName: NomadJobName
NomadAllocationId: NomadAllocationId
DockerImageVersion: DockerImageVersion
}
Expand All @@ -59,10 +48,6 @@ let createStatus (currentApplication: CurrentApplication) =
interface ApplicationStatusFeature.IDockerApplication with
member __.DockerImageVersion = currentApplication.DockerImageVersion
interface ApplicationStatusFeature.INomadApplication with
member __.NomadJobName = currentApplication.NomadJobName
member __.NomadAllocationId = currentApplication.NomadAllocationId
}
```

Expand Down
4 changes: 2 additions & 2 deletions build/Build.fs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ let main args =
Targets.init {
Project = {
Name = "Alma.ApplicationStatus"
Summary = "Types for an common Application status representation used in LMC."
Summary = "Types for an common Application status representation."
Git = Git.init ()
}
Specs =
Spec.defaultLibrary
|> Spec.mapLibrary (fun library -> { library with NugetApi = NugetApi.Organization "almacareer" })
|> Spec.mapLibrary (fun library -> { library with NugetApi = NugetApi.KeyInEnvironment "NUGET_API_KEY" })
}

args |> Args.run
6 changes: 2 additions & 4 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ source https://api.nuget.org/v3/index.json
nuget FSharp.Core ~> 9.0
nuget FSharp.Data ~> 6.0

source https://nuget.pkg.github.com/almacareer/index.json username: "%PRIVATE_FEED_USER%" password: "%PRIVATE_FEED_PASS%"
# LMC Nuget dependencies:
nuget Alma.EnvironmentModel ~> 8.1
nuget Alma.ServiceIdentification ~> 10.0
nuget Alma.EnvironmentModel ~> 9.0
nuget Alma.ServiceIdentification ~> 10.1

nuget Expecto
nuget YoloDev.Expecto.TestSdk
Expand Down
19 changes: 9 additions & 10 deletions paket.lock
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
RESTRICTION: == net9.0
NUGET
remote: https://nuget.pkg.github.com/almacareer/index.json
Alma.EnvironmentModel (8.1.0)
Alma.ErrorHandling (>= 10.0 < 11.0)
Alma.ServiceIdentification (>= 10.0 < 11.0)
FSharp.Core (>= 9.0.201 < 10.0)
Alma.ErrorHandling (10.0.0)
FSharp.Core (>= 9.0.201 < 10.0)
Alma.ServiceIdentification (10.0.0)
FSharp.Core (>= 9.0.201 < 10.0)
remote: https://api.nuget.org/v3/index.json
Alma.EnvironmentModel (9.1)
Alma.ServiceIdentification (>= 10.1 < 11.0)
Feather.ErrorHandling (>= 1.0 < 2.0)
FSharp.Core (>= 9.0.303 < 10.0)
Alma.ServiceIdentification (10.1)
FSharp.Core (>= 9.0.201 < 10.0)
Expecto (10.2.2)
FSharp.Core (>= 7.0.200)
Mono.Cecil (>= 0.11.4 < 1.0)
FSharp.Core (9.0.201)
Feather.ErrorHandling (1.0)
FSharp.Core (>= 9.0.201 < 10.0)
FSharp.Core (9.0.303)
FSharp.Data (6.6)
FSharp.Core (>= 6.0.1)
FSharp.Data.Csv.Core (>= 6.6)
Expand Down
32 changes: 0 additions & 32 deletions src/ApplicationStatus.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ type GitRepository = GitRepository of string

type DockerImageVersion = DockerImageVersion of string

type NomadJobName = NomadJobName of string
type NomadAllocationId = NomadAllocationId of string

[<RequireQualifiedAccess>]
module GitBranch =
let value (GitBranch value) = value
Expand All @@ -36,16 +33,6 @@ module DockerImageVersion =
let value (DockerImageVersion value) = value
let empty = DockerImageVersion ""

[<RequireQualifiedAccess>]
module NomadJobName =
let value (NomadJobName value) = value
let empty = NomadJobName ""

[<RequireQualifiedAccess>]
module NomadAllocationId =
let value (NomadAllocationId value) = value
let empty = NomadAllocationId ""

//
// Application Status Interfaces
//
Expand All @@ -64,10 +51,6 @@ module ApplicationStatusFeature =
type IDockerApplication =
abstract member DockerImageVersion: DockerImageVersion

type INomadApplication =
abstract member NomadJobName: NomadJobName
abstract member NomadAllocationId: NomadAllocationId

module internal Matching =
let (|IsCurrentApplication|_|): obj -> ICurrentApplication option = box >> function
| :? ICurrentApplication as currentApplication -> Some currentApplication
Expand All @@ -81,10 +64,6 @@ module ApplicationStatusFeature =
| :? IDockerApplication as dockerAppliation -> Some dockerAppliation
| _ -> None

let (|IsNomadApplication|_|): obj -> INomadApplication option = box >> function
| :? INomadApplication as nomadApplication -> Some nomadApplication
| _ -> None

//
// Application Status
//
Expand All @@ -102,8 +81,6 @@ type ApplicationStatus = {
[<XmlElement("sourceRevision")>] SourceRevision: string
[<XmlElement("repository")>] Repository: string
[<XmlElement("hostName")>] HostName: string
[<XmlElement("nomadJobName")>] NomadJobName: string
[<XmlElement("nomadAllocId")>] NomadAllocId: string
}

[<RequireQualifiedAccess>]
Expand Down Expand Up @@ -148,13 +125,4 @@ module ApplicationStatus =
| _ -> ""

HostName = try Dns.GetHostName() with _ -> ""

NomadJobName =
match application with
| IsNomadApplication nomadApplication -> nomadApplication.NomadJobName |> NomadJobName.value
| _ -> ""
NomadAllocId =
match application with
| IsNomadApplication nomadApplication -> nomadApplication.NomadAllocationId |> NomadAllocationId.value
| _ -> ""
}
10 changes: 0 additions & 10 deletions tests/CreationTest.fs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ let provideApplicationStatus: ApplicationStatusTestCase<_> list =

interface ApplicationStatusFeature.IDockerApplication with
member __.DockerImageVersion = DockerImageVersion "DockerImageVersion"

interface ApplicationStatusFeature.INomadApplication with
member __.NomadJobName = NomadJobName "NomadJobName"
member __.NomadAllocationId = NomadAllocationId "NomadAllocationId"
}
ExpectedStatus = {
Name = "lmc-service-common-stable"
Expand All @@ -51,8 +47,6 @@ let provideApplicationStatus: ApplicationStatusTestCase<_> list =
SourceRevision = "GitCommit"
Repository = "GitRepository"
HostName = hostName
NomadJobName = "NomadJobName"
NomadAllocId = "NomadAllocationId"
}
}
{
Expand All @@ -79,8 +73,6 @@ let provideApplicationStatus: ApplicationStatusTestCase<_> list =
SourceRevision = "GitCommit"
Repository = "GitRepository"
HostName = hostName
NomadJobName = ""
NomadAllocId = ""
}
}
{
Expand All @@ -99,8 +91,6 @@ let provideApplicationStatus: ApplicationStatusTestCase<_> list =
SourceRevision = ""
Repository = ""
HostName = hostName
NomadJobName = ""
NomadAllocId = ""
}
}
]
Expand Down
4 changes: 0 additions & 4 deletions tests/SerializationTest.fs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ let serializationTest =
SourceRevision = "GitCommit"
Repository = ""
HostName = "HostName"
NomadJobName = "NomadJobName"
NomadAllocId = "NomadAllocationId"
}

let actual = XML.serialize<ApplicationStatus> status
Expand All @@ -54,8 +52,6 @@ let serializationTest =
<sourceRevision>GitCommit</sourceRevision>
<repository />
<hostName>HostName</hostName>
<nomadJobName>NomadJobName</nomadJobName>
<nomadAllocId>NomadAllocationId</nomadAllocId>
</appStatus>"""

Expect.equal actual expected "Application status should be serialized to XML"
Expand Down