Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
console
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
console
Commits
78cd894a
Commit
78cd894a
authored
Oct 09, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better upload thing
parent
f9ce2975
Pipeline
#40959
passed with stages
in 9 minutes and 35 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
11 deletions
+17
-11
console-api/src/packager/packager.service.ts
console-api/src/packager/packager.service.ts
+9
-7
console-api/src/s3/s3.service.ts
console-api/src/s3/s3.service.ts
+8
-4
No files found.
console-api/src/packager/packager.service.ts
View file @
78cd894a
...
...
@@ -365,9 +365,9 @@ export class PackagerService extends ConsoleLogger {
});
const
hashObject
=
createHash
(
'
sha256
'
);
const
md5Object
=
createHash
(
'
md5
'
);
//
let length = 0;
let
length
=
0
;
child
.
stdout
.
on
(
'
data
'
,
(
chunk
)
=>
{
//
length += chunk.length;
length
+=
chunk
.
length
;
// this.log(`Received ${length} bytes of archive ${archiveName}.`);
hashObject
.
update
(
chunk
);
md5Object
.
update
(
chunk
);
...
...
@@ -397,15 +397,17 @@ export class PackagerService extends ConsoleLogger {
const
uploadPromise
=
this
.
s3
.
uploadStream
(
archiveName
,
uploadStream
,
{
ContentType
:
'
application/tar+zstd
'
,
});
const
[,
{
object
}
]
=
await
Promise
.
all
([
childPromise
,
uploadPromise
]);
const
[,
uploadRes
]
=
await
Promise
.
all
([
childPromise
,
uploadPromise
]);
archive
.
hash
=
hashObject
.
digest
(
'
hex
'
);
const
md5
=
md5Object
.
digest
(
'
hex
'
);
const
md5InS3
=
await
this
.
s3
.
getObjectHash
(
archiveName
);
if
(
md5InS3
!==
md5
)
{
throw
new
Error
(
`MD5 mismatch for archive
${
archiveName
}
: local
${
md5
}
vs s3
${
md5InS3
}
`
);
if
(
length
!==
uploadRes
.
object
.
ContentLength
)
{
throw
new
Error
(
`Length mismatch for archive
${
archiveName
}
: local
${
length
}
vs s3
${
uploadRes
.
object
.
ContentLength
}
`
);
}
if
(
uploadRes
.
md5
!==
md5
)
{
throw
new
Error
(
`MD5 mismatch for archive
${
archiveName
}
: local
${
md5
}
vs s3
${
uploadRes
.
md5
}
`
);
}
await
this
.
redis
.
set
(
`hash:
${
archive
.
path
}
`
,
archive
.
hash
,
'
EX
'
,
60
*
60
*
24
);
archive
.
size
=
object
.
Size
;
archive
.
size
=
length
;
this
.
log
(
`Finished archiving
${
archiveName
}
.`
);
return
archive
;
}
catch
(
e
)
{
...
...
console-api/src/s3/s3.service.ts
View file @
78cd894a
...
...
@@ -198,9 +198,13 @@ export class S3Service extends ConsoleLogger {
},
});
await
upload
.
done
();
const
{
Contents
:
[
object
],
}
=
await
this
.
listObjects
(
path
);
return
{
object
,
url
:
this
.
getCdnUrl
(
path
)
};
const
object
=
await
this
.
s3
.
send
(
new
HeadObjectCommand
({
Bucket
:
this
.
bucket
,
Key
:
key
,
})
);
const
md5
=
object
.
ETag
?
object
.
ETag
.
replace
(
/"/g
,
''
)
:
undefined
;
return
{
object
,
md5
,
url
:
this
.
getCdnUrl
(
path
)
};
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment