-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: build/install checksum link (#134)
* feat: build/install checksum link * feat: add artifact api * feat: update dependencies
- Loading branch information
Showing
23 changed files
with
863 additions
and
422 deletions.
There are no files selected for viewing
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 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,25 @@ | ||
{ | ||
"event": { | ||
"provider": "github-action-demo", | ||
"reason": "Job triggered", | ||
"url": "JOB_URL" | ||
}, | ||
"actions": [ | ||
{ | ||
"action": "package-installation", | ||
"id": "install", | ||
"provision": [], | ||
"service": { | ||
"project": "superapp", | ||
"name": "superapp-backend", | ||
"environment": "development" | ||
}, | ||
"package": { | ||
"type": "zip" | ||
} | ||
} | ||
], | ||
"user": { | ||
"name": "USER_ID@IDP" | ||
} | ||
} |
This file contains 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,41 @@ | ||
#!/usr/bin/env bash | ||
[ -n "$ZSH_VERSION" ] && this_dir=$(dirname "${(%):-%x}") \ | ||
|| this_dir=$(dirname "${BASH_SOURCE[0]:-$0}") | ||
cd "$this_dir" | ||
|
||
BUILD_CHECKSUM="sha256:$(cat provision-app-quick-build.artifact.sha256)" | ||
echo $BUILD_CHECKSUM | ||
BUILD_GUID="$(cat provision-app-quick-build.trace.id)" | ||
echo $BUILD_GUID | ||
|
||
echo "===> Intention open" | ||
# Open intention | ||
RESPONSE=$(curl -s -X POST $BROKER_URL/v1/intention/open?ttl=30\&quickstart=true \ | ||
-H 'Content-Type: application/json' \ | ||
-H "Authorization: Bearer $BROKER_JWT" \ | ||
-d @<(cat provision-app-quick-install.json | \ | ||
jq ".event.url=\"http://sample.com/job\" | \ | ||
.user.name=\"hgoddard@idp\" | \ | ||
(.actions[] | select(.id == \"install\") .package.buildGuid) |= \"$BUILD_GUID\" | \ | ||
" \ | ||
)) | ||
echo "$BROKER_URL/v1/intention/open:" | ||
echo $RESPONSE | jq '.' | ||
if [ "$(echo $RESPONSE | jq '.error')" != "null" ]; then | ||
echo "Exit: Error detected" | ||
exit 0 | ||
fi | ||
|
||
# Save intention token for later | ||
INTENTION_TOKEN=$(echo $RESPONSE | jq -r '.token') | ||
# echo "Hashed transaction.id: $(echo -n $INTENTION_TOKEN | shasum -a 256)" | ||
|
||
echo "===> Install" | ||
|
||
# Not shown: Install superapp | ||
echo "===> ..." | ||
echo "===> Install - Success!" | ||
echo "===> Intention close" | ||
|
||
# Use saved intention token to close intention | ||
curl -s -X POST $BROKER_URL/v1/intention/close -H 'X-Broker-Token: '"$INTENTION_TOKEN"'' |
This file contains 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 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 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 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 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,31 @@ | ||
import { Type } from 'class-transformer'; | ||
import { IsInt, IsOptional, IsString } from 'class-validator'; | ||
|
||
export class ArtifactSearchQuery { | ||
@IsString() | ||
@IsOptional() | ||
buildGuid?: string; | ||
|
||
@IsString() | ||
@IsOptional() | ||
checksum?: string; | ||
|
||
@IsString() | ||
@IsOptional() | ||
name?: string; | ||
|
||
@IsString() | ||
service: string; | ||
|
||
@IsInt() | ||
@Type(() => Number) | ||
offset: number; | ||
|
||
@IsString() | ||
@IsOptional() | ||
type?: string; | ||
|
||
@IsInt() | ||
@Type(() => Number) | ||
limit: number; | ||
} |
This file contains 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,17 @@ | ||
// Shared DTO: Copy in back-end and front-end should be identical | ||
|
||
import { ActionDto } from './action.dto'; | ||
import { ArtifactDto } from './artifact.dto'; | ||
import { IntentionDto } from './intention.dto'; | ||
|
||
export class ArtifactActionCombo { | ||
action!: ActionDto; | ||
artifact!: ArtifactDto; | ||
} | ||
export class ArtifactSearchResult { | ||
data!: IntentionDto[]; | ||
artifacts!: ArtifactActionCombo[]; | ||
meta!: { | ||
total: number; | ||
}; | ||
} |
This file contains 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 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 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
Oops, something went wrong.