Skip to content

Commit

Permalink
Merge pull request #121 from siemens/development
Browse files Browse the repository at this point in the history
Hotfix for JFrog Ref token validation
  • Loading branch information
sumanthkb44 authored Feb 2, 2024
2 parents ba44628 + a326d0d commit 4113b85
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 21 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
$sourceFolder = Join-Path $env:GITHUB_WORKSPACE "out" | Join-Path -ChildPath "*"
$outFolder = Join-Path $env:GITHUB_WORKSPACE "out" | Join-Path -ChildPath "continuous-clearing"
New-Item -ItemType Directory -Force -Path $outFolder
$fileName = "continuous-clearing-v6.0.1.zip"
$fileName = "continuous-clearing-v6.0.2.zip"
Write-Host "Filename: '$fileName'"
Write-Host "sourceFolder: '$sourceFolder'"
Write-Host "Outfolder: '$outFolder'"
Expand Down Expand Up @@ -139,8 +139,8 @@ jobs:
- name: Create Nuget Packages
id: createNupkg
run: |
nuget pack CA.nuspec -Version 6.0.1
Write-Host "::set-output name=nupkg-LicenseClearingTool::continuous-clearing.6.0.1.nupkg"
nuget pack CA.nuspec -Version 6.0.2
Write-Host "::set-output name=nupkg-LicenseClearingTool::continuous-clearing.6.0.2.nupkg"
- name: Archive NuGet Packages
uses: actions/upload-artifact@v2
Expand All @@ -153,9 +153,9 @@ jobs:
id: builddocker
#if: ${{ false }} # disable for now
run: |
docker build . --file Dockerfile --tag ${{ github.repository }}:continuous-clearing-v6.0.1
docker save ${{ github.repository }}:continuous-clearing-v6.0.1 -o continuous-clearing-v6.0.1.tar
Write-Host "::set-output name=docker-LicenseClearingTool::continuous-clearing-v6.0.1.tar"
docker build . --file Dockerfile --tag ${{ github.repository }}:continuous-clearing-v6.0.2
docker save ${{ github.repository }}:continuous-clearing-v6.0.2 -o continuous-clearing-v6.0.2.tar
Write-Host "::set-output name=docker-LicenseClearingTool::continuous-clearing-v6.0.2.tar"
- name: Archive docker image
#if: ${{ false }} # disable for now
Expand Down Expand Up @@ -196,8 +196,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v6.0.1
release_name: Release v6.0.1
tag_name: v6.0.2
release_name: Release v6.0.2
body: |
${{ github.event.head_commit.message }}
draft: true
Expand Down
2 changes: 1 addition & 1 deletion CA.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<package >
<metadata>
<id>continuous-clearing</id>
<version>6.0.1</version>
<version>6.0.2</version>
<authors>Siemens AG</authors>
<owners>continuous-clearing contributors</owners>
<projectUrl>https://github.com/siemens/continuous-clearing</projectUrl>
Expand Down
20 changes: 9 additions & 11 deletions src/ArtifactoryUploader/ArtifactoryValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using System.Net.Http;
using System.Reflection;
using System.Threading.Tasks;
using System.Net;

namespace LCT.ArtifactoryUploader
{
Expand All @@ -27,18 +28,15 @@ public ArtifactoryValidator(NpmJfrogApiCommunication jfrogApiCommunication)
JfrogApiCommunication = jfrogApiCommunication;
}

public async Task ValidateArtifactoryCredentials(CommonAppSettings appSettings)
{
HttpResponseMessage responseMessage = await JfrogApiCommunication.GetApiKey();
string response = await responseMessage.Content.ReadAsStringAsync();
JfrogKey apiKey = JsonConvert.DeserializeObject<JfrogKey>(response);
public async Task ValidateArtifactoryCredentials(CommonAppSettings appSettings)
{
HttpResponseMessage responseMessage = await JfrogApiCommunication.GetApiKey();

bool isValid = apiKey.ApiKey == appSettings.ArtifactoryUploadApiKey;
if (!isValid)
{
Logger.Error("Artifactory Token entered is invalid!");
throw new InvalidDataException($"Invalid Artifactory Token");
}
if (responseMessage.StatusCode != HttpStatusCode.OK)
{
Logger.Error("Artifactory Token entered is invalid!");
throw new InvalidDataException($"Invalid Artifactory Token");
}
}
}
}
2 changes: 1 addition & 1 deletion src/LCT.Common/appSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// --------------------------------------------------------------------------------------------------------------------

{
"CaVersion": "6.0.1",
"CaVersion": "6.0.2",
"TimeOut": 200,
"ProjectType": "<Insert ProjectType>",
"SW360ProjectName": "<Insert SW360 Project Name>",
Expand Down

0 comments on commit 4113b85

Please sign in to comment.