diff --git a/api/publish.go b/api/publish.go index 538234a3..6d2c544f 100644 --- a/api/publish.go +++ b/api/publish.go @@ -97,6 +97,7 @@ func apiPublishRepoOrSnapshot(c *gin.Context) { Label string Origin string ForceOverwrite bool + SkipContents *bool Architectures []string Signing SigningOptions } @@ -183,6 +184,11 @@ func apiPublishRepoOrSnapshot(c *gin.Context) { published.Origin = b.Origin published.Label = b.Label + published.SkipContents = context.Config().SkipContentsPublishing + if b.SkipContents != nil { + published.SkipContents = *b.SkipContents + } + duplicate := collection.CheckDuplicate(published) if duplicate != nil { context.CollectionFactory().PublishedRepoCollection().LoadComplete(duplicate, context.CollectionFactory()) @@ -213,6 +219,7 @@ func apiPublishUpdateSwitch(c *gin.Context) { var b struct { ForceOverwrite bool Signing SigningOptions + SkipContents *bool Snapshots []struct { Component string `binding:"required"` Name string `binding:"required"` @@ -291,6 +298,10 @@ func apiPublishUpdateSwitch(c *gin.Context) { c.Fail(500, fmt.Errorf("unknown published repository type")) } + if b.SkipContents != nil { + published.SkipContents = *b.SkipContents + } + err = published.Publish(context.PackagePool(), context, context.CollectionFactory(), signer, nil, b.ForceOverwrite) if err != nil { c.Fail(500, fmt.Errorf("unable to update: %s", err)) diff --git a/cmd/publish_snapshot.go b/cmd/publish_snapshot.go index a796d33b..32fb1a8e 100644 --- a/cmd/publish_snapshot.go +++ b/cmd/publish_snapshot.go @@ -119,6 +119,8 @@ func aptlyPublishSnapshotOrRepo(cmd *commander.Command, args []string) error { published.Origin = context.Flags().Lookup("origin").Value.String() published.Label = context.Flags().Lookup("label").Value.String() + published.SkipContents = context.Config().SkipContentsPublishing + if context.Flags().IsSet("skip-contents") { published.SkipContents = context.Flags().Lookup("skip-contents").Value.Get().(bool) } diff --git a/deb/publish.go b/deb/publish.go index 8b98cc45..1e698c0b 100644 --- a/deb/publish.go +++ b/deb/publish.go @@ -290,6 +290,7 @@ func (p *PublishedRepo) MarshalJSON() ([]byte, error) { "SourceKind": p.SourceKind, "Sources": sources, "Storage": p.Storage, + "SkipContents": p.SkipContents, }) } diff --git a/man/aptly.1 b/man/aptly.1 index f7926322..8a18f1f0 100644 --- a/man/aptly.1 +++ b/man/aptly.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "APTLY" "1" "January 2016" "" "" +.TH "APTLY" "1" "February 2016" "" "" . .SH "NAME" \fBaptly\fR \- Debian repository management tool @@ -48,6 +48,7 @@ Configuration file is stored in JSON format (default values shown below): "downloadSourcePackages": false, "ppaDistributorID": "ubuntu", "ppaCodename": "", + "skipContentsPublishing": false, "S3PublishEndpoints": { "test": { "region": "us\-east\-1", @@ -55,7 +56,6 @@ Configuration file is stored in JSON format (default values shown below): "endpoint": "", "awsAccessKeyID": "", "awsSecretAccessKey": "", - "awsSessionToken": "", "prefix": "", "acl": "public\-read", "storageClass": "", @@ -1819,5 +1819,8 @@ Vincent Bernat (https://github\.com/vincentbernat) .IP "\[ci]" 4 x539 (https://github\.com/x539) . +.IP "\[ci]" 4 +Phil Frost (https://github\.com/bitglue) +. .IP "" 0 diff --git a/man/aptly.1.ronn.tmpl b/man/aptly.1.ronn.tmpl index a85b93dd..596e5d41 100644 --- a/man/aptly.1.ronn.tmpl +++ b/man/aptly.1.ronn.tmpl @@ -40,6 +40,7 @@ Configuration file is stored in JSON format (default values shown below): "downloadSourcePackages": false, "ppaDistributorID": "ubuntu", "ppaCodename": "", + "skipContentsPublishing": false, "S3PublishEndpoints": { "test": { "region": "us-east-1", diff --git a/system/t02_config/ConfigShowTest_gold b/system/t02_config/ConfigShowTest_gold index 6b537b76..c9d928e9 100644 --- a/system/t02_config/ConfigShowTest_gold +++ b/system/t02_config/ConfigShowTest_gold @@ -12,6 +12,7 @@ "downloadSourcePackages": false, "ppaDistributorID": "ubuntu", "ppaCodename": "", + "skipContentsPublishing": false, "S3PublishEndpoints": {}, "SwiftPublishEndpoints": {} } diff --git a/system/t02_config/CreateConfigTest_gold b/system/t02_config/CreateConfigTest_gold index 1e827c19..509814be 100644 --- a/system/t02_config/CreateConfigTest_gold +++ b/system/t02_config/CreateConfigTest_gold @@ -12,6 +12,7 @@ "downloadSourcePackages": false, "ppaDistributorID": "ubuntu", "ppaCodename": "", + "skipContentsPublishing": false, "S3PublishEndpoints": {}, "SwiftPublishEndpoints": {} } \ No newline at end of file diff --git a/system/t12_api/publish.py b/system/t12_api/publish.py index 1a64a591..e161ed53 100644 --- a/system/t12_api/publish.py +++ b/system/t12_api/publish.py @@ -41,6 +41,7 @@ class PublishAPITestRepo(APITest): 'Label': '', 'Origin': '', 'Prefix': prefix, + 'SkipContents': False, 'SourceKind': 'local', 'Sources': [{'Component': 'main', 'Name': repo_name}], 'Storage': ''} @@ -74,6 +75,7 @@ class PublishAPITestRepo(APITest): 'Label': '', 'Origin': '', 'Prefix': ".", + 'SkipContents': False, 'SourceKind': 'local', 'Sources': [{'Component': 'main', 'Name': repo_name}], 'Storage': ''} @@ -129,6 +131,7 @@ class PublishSnapshotAPITest(APITest): 'Label': '', 'Origin': '', 'Prefix': prefix, + 'SkipContents': False, 'SourceKind': 'snapshot', 'Sources': [{'Component': 'main', 'Name': snapshot_name}], 'Storage': ''}) @@ -188,6 +191,7 @@ class PublishUpdateAPITestRepo(APITest): 'Label': '', 'Origin': '', 'Prefix': prefix, + 'SkipContents': False, 'SourceKind': 'local', 'Sources': [{'Component': 'main', 'Name': repo_name}], 'Storage': ''} @@ -238,6 +242,7 @@ class PublishSwitchAPITestRepo(APITest): 'Label': '', 'Origin': '', 'Prefix': prefix, + 'SkipContents': False, 'SourceKind': 'snapshot', 'Sources': [{'Component': 'main', 'Name': snapshot1_name}], 'Storage': ''} @@ -261,6 +266,7 @@ class PublishSwitchAPITestRepo(APITest): json={ "Snapshots": [{"Component": "main", "Name": snapshot2_name}], "Signing": DefaultSigningOptions, + "SkipContents": True, }) repo_expected = { 'Architectures': ['i386', 'source'], @@ -268,6 +274,7 @@ class PublishSwitchAPITestRepo(APITest): 'Label': '', 'Origin': '', 'Prefix': prefix, + 'SkipContents': True, 'SourceKind': 'snapshot', 'Sources': [{'Component': 'main', 'Name': snapshot2_name}], 'Storage': ''} diff --git a/utils/config.go b/utils/config.go index ac3a9f08..5ec86dd1 100644 --- a/utils/config.go +++ b/utils/config.go @@ -21,6 +21,7 @@ type ConfigStructure struct { DownloadSourcePackages bool `json:"downloadSourcePackages"` PpaDistributorID string `json:"ppaDistributorID"` PpaCodename string `json:"ppaCodename"` + SkipContentsPublishing bool `json:"skipContentsPublishing"` S3PublishRoots map[string]S3PublishRoot `json:"S3PublishEndpoints"` SwiftPublishRoots map[string]SwiftPublishRoot `json:"SwiftPublishEndpoints"` } diff --git a/utils/config_test.go b/utils/config_test.go index b98b4b4a..8bcfc0cd 100644 --- a/utils/config_test.go +++ b/utils/config_test.go @@ -62,6 +62,7 @@ func (s *ConfigSuite) TestSaveConfig(c *C) { " \"downloadSourcePackages\": false,\n"+ " \"ppaDistributorID\": \"\",\n"+ " \"ppaCodename\": \"\",\n"+ + " \"skipContentsPublishing\": false,\n"+ " \"S3PublishEndpoints\": {\n"+ " \"test\": {\n"+ " \"region\": \"us-east-1\",\n"+