From 8f418984f8a8af0abeb3917554d29f13b50cb8f5 Mon Sep 17 00:00:00 2001 From: Marcel Schork Date: Mon, 15 Apr 2024 12:47:15 +0200 Subject: [PATCH] feat: use metadata prop Bundle-SymbolicName as artifact id. (#75) * feat: use metadata prop Bundle-SymbolicName as artifact id and Origin-Bundle-SymbolicName as fallback * ci: update to latest Sonar scan task und install Java 17 required for the scan to run --- .github/workflows/node-ci.yml | 6 +++++- src/lib/client/ManifestReader.ts | 4 ++-- .../META-INF/MANIFEST.MF | 2 +- src/test/integration/IntegrationFlow.test.ts | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml index b9a3ac0..7ca9823 100644 --- a/.github/workflows/node-ci.yml +++ b/.github/workflows/node-ci.yml @@ -11,7 +11,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: SonarSource/sonarqube-scan-action@v1.1.0 + - uses: actions/setup-java@v2 + with: + java-version: '17' + distribution: 'adopt' + - uses: SonarSource/sonarqube-scan-action@v2.0.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/src/lib/client/ManifestReader.ts b/src/lib/client/ManifestReader.ts index efbfe19..6c65a6c 100644 --- a/src/lib/client/ManifestReader.ts +++ b/src/lib/client/ManifestReader.ts @@ -33,8 +33,8 @@ export default class ManifestReader { getArtifactMetadata(): Artifact { return { Id: - (this.manifestEntries.get('Origin-Bundle-SymbolicName') as string) || - (this.manifestEntries.get('Bundle-SymbolicName') as string).split(';')[0], + (this.manifestEntries.get('Bundle-SymbolicName') as string).split(';')[0] || + (this.manifestEntries.get('Origin-Bundle-SymbolicName') as string), Version: this.manifestEntries.get('Bundle-Version') as string, Name: this.manifestEntries.get('Bundle-Name') as string, Type: this.manifestEntries.get('SAP-BundleType') as ArtifactType, diff --git a/src/test/Testpackage/com.sap.SFIHCM03.hcm2bizx.SFSFOffboardingGetOffboardUserRecordWithExpabcd.EBZ/META-INF/MANIFEST.MF b/src/test/Testpackage/com.sap.SFIHCM03.hcm2bizx.SFSFOffboardingGetOffboardUserRecordWithExpabcd.EBZ/META-INF/MANIFEST.MF index 4c85f75..fab784d 100644 --- a/src/test/Testpackage/com.sap.SFIHCM03.hcm2bizx.SFSFOffboardingGetOffboardUserRecordWithExpabcd.EBZ/META-INF/MANIFEST.MF +++ b/src/test/Testpackage/com.sap.SFIHCM03.hcm2bizx.SFSFOffboardingGetOffboardUserRecordWithExpabcd.EBZ/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-Description: Bundle-SymbolicName: com.sap.SFIHCM03.hcm2bizx.SFSFOffboardingGetOffbo - ardUserRecordWithExpabcd; singleton:=true + ardUserRecordWithExpabcd.EBZ; singleton:=true Origin-Bundle-SymbolicName: com.sap.SFIHCM03.hcm2bizx.SFSFOffboardingG etOffboardUserRecordWithExpabcd Bundle-ManifestVersion: 2 diff --git a/src/test/integration/IntegrationFlow.test.ts b/src/test/integration/IntegrationFlow.test.ts index aa9e3ea..d799712 100644 --- a/src/test/integration/IntegrationFlow.test.ts +++ b/src/test/integration/IntegrationFlow.test.ts @@ -32,7 +32,7 @@ describe('Integration flow', () => { }); it('fetch an integration flow ', async () => { - const iFlowId = sciRestClient.getArtifactMetadata(path.join(artiFactDirectory, 'TestPackage', iFlowFolder)).Id; + const iFlowId = sciRestClient.getArtifactMetadata(path.join(artiFactDirectory, 'Testpackage', iFlowFolder)).Id; const readStream = (await sciRestClient.getArtifact(iFlowId, '1.0.0', 'IntegrationFlow')) as ReadStream; const writer = fs.createWriteStream(path.join(artiFactDirectory, 'test.zip'));