Skip to content

Commit

Permalink
impl: let manifest file specify --enable-network for mock
Browse files Browse the repository at this point in the history
For bazel, we need to fetch resources from the network. After some
fixes, we'll be fetching them from artifactory, at least.

This requires configuring "enable-network" for the mock call.
  • Loading branch information
wade-arista authored and aajith-arista committed Apr 16, 2024
1 parent 490fdaa commit 9cacf77
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions impl/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ func (bldr *mockBuilder) runFedoraMockStages() error {
if bldr.noCheck {
buildArgs = append(buildArgs, "--nocheck")
}
if bldr.enableNetwork {
buildArgs = append(buildArgs, "--enable-network")
}
bldr.log("starting")
if err := bldr.runMockCmd(buildArgs); err != nil {
return err
Expand Down Expand Up @@ -403,6 +406,7 @@ func Mock(repo string, pkg string, arch string, extraArgs MockExtraCmdlineArgs)
dnfConfig: dnfConfig,
errPrefix: errPrefix,
dependencyList: dependencyList,
enableNetwork: pkgSpec.Build.EnableNetwork,
},
onlyCreateCfg: extraArgs.OnlyCreateCfg,
noCheck: extraArgs.NoCheck,
Expand Down
1 change: 1 addition & 0 deletions impl/mock_cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type builderCommon struct {
dnfConfig *dnfconfig.DnfConfig
errPrefix util.ErrPrefix
dependencyList []string
enableNetwork bool
}

type mockCfgBuilder struct {
Expand Down
9 changes: 5 additions & 4 deletions manifest/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ type Generator struct {
// Generator specifies commands for eext generator
// Refer to Generator struct denifition above.
type Build struct {
Include []string `yaml:"include"`
RepoBundle []RepoBundle `yaml:"repo-bundle"`
Dependencies map[string][]string `yaml:"dependencies"`
Generator Generator `yaml:"eextgen"`
Include []string `yaml:"include"`
RepoBundle []RepoBundle `yaml:"repo-bundle"`
Dependencies map[string][]string `yaml:"dependencies"`
Generator Generator `yaml:"eextgen"`
EnableNetwork bool `yaml:"enable-network"`
}

// DetachedSignature spec
Expand Down

0 comments on commit 9cacf77

Please sign in to comment.