Commit cabd0a43 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Update build artifacts metadata version to 0.0.2

parent 1556bee3
package artifacts package artifacts
import ( import (
"archive/zip" "archive/zip"
"io"
"encoding/binary" "encoding/binary"
"encoding/json" "encoding/json"
"io"
"strconv"
) )
type metadata struct { type metadata struct {
Modified uint16 `json:"modified"` Modified int64 `json:"modified"`
Mode string `json:"mode"`
CRC uint32 `json:"crc,omitempty"` CRC uint32 `json:"crc,omitempty"`
Size uint64 `json:"size,omitempty"` Size uint64 `json:"size,omitempty"`
Zipped uint64 `json:"zipped,omitempty"` Zipped uint64 `json:"zipped,omitempty"`
...@@ -16,10 +19,11 @@ type metadata struct { ...@@ -16,10 +19,11 @@ type metadata struct {
func newMetadata(file *zip.File) metadata { func newMetadata(file *zip.File) metadata {
return metadata{ return metadata{
Modified: file.ModifiedDate, Modified: file.ModTime().Unix(),
Mode: strconv.FormatUint(uint64(file.Mode().Perm()), 8),
CRC: file.CRC32, CRC: file.CRC32,
Size: file.CompressedSize64, Size: file.UncompressedSize64,
Zipped: file.UncompressedSize64, Zipped: file.CompressedSize64,
Comment: file.Comment, Comment: file.Comment,
} }
} }
...@@ -34,7 +38,7 @@ func (m metadata) write(output io.Writer) error { ...@@ -34,7 +38,7 @@ func (m metadata) write(output io.Writer) error {
} }
func generateZipMetadata(output io.Writer, archive *zip.Reader) error { func generateZipMetadata(output io.Writer, archive *zip.Reader) error {
err := writeString(output, "GitLab Build Artifacts Metadata 0.0.1\n") err := writeString(output, "GitLab Build Artifacts Metadata 0.0.2\n")
if err != nil { if err != nil {
return err return err
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment