-
Notifications
You must be signed in to change notification settings - Fork 2
Feature/tippi 1198 tealium extension deployment #348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
botlin
merged 28 commits into
master
from
feature/TIPPI-1198-Tealium-Extension-Deployment
Jan 19, 2026
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
b582331
[TIPPI-1198] Add deployment script
botlin 52ffdd0
[TIPPI-1198] Add TealiumAPI and tests
botlin 88d5db8
[TIPPI-1198] Add config file for environment variables
botlin 5b3a938
[TIPPI-1198] Add axios as dependency
botlin b417495
[TIPPI-1198] Add Payload creation to TealiumAPI and tests
botlin 6904482
[TIPPI-1198] Add src/ to tsconfig.json
botlin f3dc2ee
[TIPPI-1198] Add GetProfile to TealiumAPI
botlin fdb2406
[TIPPI-1198] Refactoring tests
botlin 2d59f59
[TIPPI-1198] Add TealiumExtensionDiff logic and tests
botlin f7659ec
[TIPPI-1198] Smaler type changes
botlin a04cd02
[TIPPI-1198] Add TealiumDeploymentPipeline and tests
botlin 49393a9
[TIPPI-1198] Add notes and filepath to extension, including tests
botlin 6492776
[TIPPI-1198] Add Status, Occurance and Scope as another update state
botlin 610d4db
[TIPPI-1198] Finished deployment, add code minification
botlin f29e8c5
[TIPPI-1198] Add Hash to Extension to detect changes. Add Logs
botlin 2059043
[TIPPI-1198] Add Github Workflow
botlin ef4f1f5
[TIPPI-1198] Fix unit test
botlin 9e37cf7
[TIPPI-1198] Fix unit tests
botlin 60376b8
Update src/tealiumdeployment/TealiumExtensionDiff.ts
botlin 7760c7b
Update src/tealiumdeployment/deployment.ts
botlin 8956d35
Update src/tealiumdeployment/TealiumDeploymentPipeline.ts
botlin c3dea0e
[TIPPI-1198] Fix tealium_deploymenr.yml
botlin 9782fb5
[TIPPI-1198] Add tests for Extension::getHash
botlin 65f092a
[TIPPI-1198] Fix typos
botlin 43d35ec
[TIPPI-1198] Fix test
botlin c32edc0
Update src/tealiumdeployment/TealiumDeploymentPipeline.ts
botlin dca2fa3
[TIPPI-1198] Exclude all remote extensions not supported by type or s…
botlin 585c427
[TIPPI-1198] Last fixes
botlin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: Tealium Deployment | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| tealium-deployment: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: '24' | ||
|
|
||
| - name: Install dependencies | ||
| run: yarn install | ||
|
|
||
| - name: Run tests | ||
| run: yarn test | ||
|
|
||
| - name: Deploy to Tealium | ||
| env: | ||
| TEALIUM_DEPLOY_ACCOUNT: ${{ secrets.TEALIUM_DEPLOY_ACCOUNT }} | ||
| TEALIUM_DEPLOY_USER: ${{ secrets.TEALIUM_DEPLOY_USER }} | ||
| TEALIUM_DEPLOY_API_KEY: ${{ secrets.TEALIUM_DEPLOY_API_KEY }} | ||
| run: yarn deploy -- "${{ github.sha }}: ${{ github.event.head_commit.message }}" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| /* eslint-disable no-process-env */ | ||
| export const config = { | ||
| tealium: { | ||
| account: process.env.TEALIUM_DEPLOY_ACCOUNT || '', | ||
| user: process.env.TEALIUM_DEPLOY_USER || '', | ||
| apiKey: process.env.TEALIUM_DEPLOY_API_KEY || '' | ||
| } | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| import { Extension } from './Extension'; | ||
| import { ExtensionType, Occurrence, Scope, Status, TealiumExtension } from './TealiumAPI'; | ||
|
|
||
| describe('Extension', () => { | ||
| it('can be created from remote', () => { | ||
| const tealiumResponse: TealiumExtension = { | ||
| id: 7, | ||
| name: 'test-extension', | ||
| extensionId: '123', | ||
| extensionType: 'Javascript Code', | ||
| notes: 'A test note', | ||
| status: 'active', | ||
| scope: 'After Load Rules', | ||
| occurrence: 'Run Always', | ||
| configuration: { | ||
| code: 'console.log("Hello World");' | ||
| } | ||
| }; | ||
| const extension = Extension.fromRemote(tealiumResponse); | ||
| expect(extension.name).toBe('test-extension'); | ||
| expect(extension.type).toBe(ExtensionType.JavascriptCode); | ||
| expect(extension.id).toBe(7); | ||
| expect(extension.code).toBe('console.log("Hello World");'); | ||
| expect(extension.getNotes()).toBe('A test note'); | ||
| expect(extension.getFilepath()).toBe(''); | ||
| }); | ||
|
|
||
| it('can be created from local', () => { | ||
| const extension = Extension.fromLocal(123, 'test-extension', 'console.log("test");'); | ||
|
|
||
| expect(extension.name).toBe('test-extension'); | ||
| expect(extension.id).toBe(123); | ||
| expect(extension.code).toBe('console.log("test");'); | ||
| expect(extension.getNotes()).toBe(''); | ||
| }); | ||
|
|
||
| it('can have a filepath set', () => { | ||
| const extension = Extension.fromLocal(123, 'test-extension', 'console.log("test");'); | ||
| expect(extension.getFilepath()).toBe(''); | ||
| extension.setFilePath('./extension/test.js'); | ||
| expect(extension.getFilepath()).toBe('./extension/test.js'); | ||
| }); | ||
|
|
||
| it('can have notes set', () => { | ||
| const extension = Extension.fromLocal(123, 'test-extension', 'console.log("test");'); | ||
|
|
||
| expect(extension.getNotes()).toBe(''); | ||
| extension.setNotes('An example note'); | ||
| expect(extension.getNotes()).toBe('An example note'); | ||
| }); | ||
|
|
||
| describe('getHash', () => { | ||
| it('can create a hash', () => { | ||
| const extension = Extension.fromLocal(123, 'test-extension', 'console.log("test");'); | ||
| expect(extension.getHash()).toEqual('ef945f16c968dad131a99279f79c283e31816066bb48436de0265a4b3579a3b6'); | ||
| }); | ||
|
|
||
| it('changes if code is changed', () => { | ||
| const extensionA = Extension.fromLocal(123, 'test-extension', 'console.log("test");'); | ||
| expect(extensionA.getHash()).toEqual('ef945f16c968dad131a99279f79c283e31816066bb48436de0265a4b3579a3b6'); | ||
|
|
||
| const extensionB = Extension.fromLocal(123, 'test-extension', 'console.log("hello");'); | ||
| expect(extensionB.getHash()).toEqual('bcc3426863eb61436eb611ee0e328140a5e66728ddb20da68b3386be84505fee'); | ||
| }); | ||
|
|
||
| it('changes if scope is changed', () => { | ||
| const extension = Extension.fromLocal(123, 'test-extension', 'console.log("test");'); | ||
| extension.setScope(Scope.AfterLoadRules); | ||
| expect(extension.getHash()).toEqual('ef945f16c968dad131a99279f79c283e31816066bb48436de0265a4b3579a3b6'); | ||
|
|
||
| extension.setScope(Scope.BeforeLoadRules); | ||
| expect(extension.getHash()).toEqual('4e72dfe77437fb4fffbd287346c02fdcac1f24a8be398cfbd3af6bf17961a598'); | ||
| }); | ||
|
|
||
| it('changes if status is changed', () => { | ||
| const extension = Extension.fromLocal(123, 'test-extension', 'console.log("test");'); | ||
| extension.setStatus(Status.Active); | ||
| expect(extension.getHash()).toEqual('ef945f16c968dad131a99279f79c283e31816066bb48436de0265a4b3579a3b6'); | ||
|
|
||
| extension.setStatus(Status.Inactive); | ||
| expect(extension.getHash()).toEqual('179acdade713e698c8eae9606574108f3d7a6552e002a6904fe2880a37cffbae'); | ||
| }); | ||
|
|
||
| it('changes if occurrence is changed', () => { | ||
| const extension = Extension.fromLocal(123, 'test-extension', 'console.log("test");'); | ||
| extension.setOccurrence(Occurrence.RunAlways); | ||
| expect(extension.getHash()).toEqual('ef945f16c968dad131a99279f79c283e31816066bb48436de0265a4b3579a3b6'); | ||
|
|
||
| extension.setOccurrence(Occurrence.RunOnce); | ||
| expect(extension.getHash()).toEqual('2d6aa9f8d52fa90d61833171b1d5a0adfb6300b2d9c5767eafaf451d5665eb16'); | ||
| }); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| import { Occurrence, Status, TealiumExtension, Scope, ExtensionType } from './TealiumAPI'; | ||
| import crypto from 'node:crypto'; | ||
|
|
||
| export class Extension { | ||
|
|
||
| static fromRemote(data: TealiumExtension): Extension { | ||
| const code = data.configuration.code; | ||
| const extension = new Extension(data.name, ExtensionType.fromString(data.extensionType), code, data.id); | ||
| extension.setScope(Scope.fromString(data.scope)); | ||
| extension.setOccurrence(Occurrence.fromString(data.occurrence)); | ||
| extension.setStatus(Status.fromString(data.status)); | ||
| extension.setNotes(data.notes); | ||
| return extension; | ||
| } | ||
|
|
||
| /** | ||
| * Creates Javascript Code extension | ||
| */ | ||
| static fromLocal(id: number, name: string, code: string, type = ExtensionType.JavascriptCode) { | ||
| return new Extension(name, type, code, id); | ||
| } | ||
|
|
||
| private filepath: string; | ||
| private notes: string; | ||
| private scope: Scope; | ||
| private occurrence: Occurrence; | ||
| private status: Status; | ||
|
|
||
| private constructor( | ||
| public readonly name: string, | ||
| public readonly type: ExtensionType, | ||
| public readonly code: string, | ||
| public readonly id?: number | ||
| ) { | ||
| this.notes = ''; | ||
| this.filepath = ''; | ||
| this.scope = Scope.AfterLoadRules; | ||
| this.occurrence = Occurrence.RunAlways; | ||
| this.status = Status.Active; | ||
| } | ||
|
|
||
| setScope(scope: Scope) { | ||
| this.scope = scope; | ||
| } | ||
|
|
||
| getScope(): Scope { | ||
| return this.scope; | ||
| } | ||
|
|
||
| setNotes(notes: string) { | ||
| this.notes = notes; | ||
| } | ||
|
|
||
| getNotes(): string { | ||
| return this.notes; | ||
| } | ||
|
|
||
| getFilepath(): string { | ||
| return this.filepath; | ||
| } | ||
|
|
||
| setFilePath(filepath: string) { | ||
| this.filepath = filepath; | ||
| } | ||
|
|
||
| setOccurrence(occurrence: Occurrence) { | ||
| this.occurrence = occurrence; | ||
| } | ||
|
|
||
| getOccurrence() { | ||
| return this.occurrence; | ||
| } | ||
|
|
||
| setStatus(status: Status) { | ||
| this.status = status; | ||
| } | ||
|
|
||
| getStatus(): Status { | ||
| return this.status; | ||
| } | ||
|
|
||
| getHash() { | ||
| const content = { | ||
| code: this.code, | ||
| scope: this.scope, | ||
| status: this.status, | ||
| occurrence: this.occurrence | ||
| }; | ||
| return crypto.createHash('sha256').update(JSON.stringify(content)).digest('hex'); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.