@@ -89,6 +89,11 @@ func (p *Pusher) Push(ctx context.Context, artifactType oci.ArtifactType,
89
89
}
90
90
repo .Client = p .Client
91
91
92
+ // Using ":latest" by default if no tag was provided.
93
+ if repo .Reference .Reference == "" {
94
+ repo .Reference .Reference = oci .DefaultTag
95
+ }
96
+
92
97
// Set remoteTarget and its tracker.
93
98
remoteTarget := oras .Target (repo )
94
99
@@ -99,16 +104,16 @@ func (p *Pusher) Push(ctx context.Context, artifactType oci.ArtifactType,
99
104
defaultCopyOptions := oras .DefaultCopyGraphOptions
100
105
defaultCopyOptions .Concurrency = 1
101
106
107
+ // Initialize the file store for this artifact.
108
+ tmpDir , err := os .MkdirTemp ("" , "falcoctl" )
109
+ if err != nil {
110
+ return nil , err
111
+ }
112
+ defer os .RemoveAll (tmpDir )
113
+
102
114
manifestDescs := make ([]* v1.Descriptor , len (o .Filepaths ))
103
115
var fileStore * file.Store
104
116
for i , artifactPath := range o .Filepaths {
105
- // Initialize the file store for this artifact
106
- tmpDir , err := os .MkdirTemp ("" , "falcoctl" )
107
- if err != nil {
108
- return nil , err
109
- }
110
- defer os .RemoveAll (tmpDir )
111
-
112
117
fileStore = file .New (tmpDir )
113
118
114
119
platform := ""
@@ -117,7 +122,11 @@ func (p *Pusher) Push(ctx context.Context, artifactType oci.ArtifactType,
117
122
}
118
123
119
124
// Prepare data layer.
120
- if dataDesc , err = p .storeMainLayer (ctx , fileStore , artifactType , artifactPath ); err != nil {
125
+ absolutePath , err := filepath .Abs (artifactPath )
126
+ if err != nil {
127
+ return nil , err
128
+ }
129
+ if dataDesc , err = p .storeMainLayer (ctx , fileStore , artifactType , absolutePath ); err != nil {
121
130
return nil , err
122
131
}
123
132
@@ -159,6 +168,11 @@ func (p *Pusher) Push(ctx context.Context, artifactType oci.ArtifactType,
159
168
160
169
// Tag the root descriptor remotely.
161
170
repo .PushReference (ctx , * rootDesc , rootReader , repo .Reference .Reference )
171
+ if len (o .Tags ) > 0 {
172
+ if err = oras .TagN (ctx , remoteTarget , repo .Reference .Reference , o .Tags , oras .DefaultTagNOptions ); err != nil {
173
+ return nil , err
174
+ }
175
+ }
162
176
163
177
return & oci.RegistryResult {
164
178
Digest : string (rootDesc .Digest ),
0 commit comments