Skip to content
This repository has been archived by the owner on Mar 6, 2022. It is now read-only.

Commit

Permalink
temporary change: bring your own android-prepare-vendor
Browse files Browse the repository at this point in the history
* due to licensing issues with android-prepare-vendor, this release is no longer providing android-prepare-vendor by default. there are now 3 local config entries that need to be provided. `apv-remote` is the remote that contains the android-prepare-vendor repo (e.g. https://github.com/example/), `apv-branch` is the branch to use (e.g. 12), and `apv-revision` the git commit to lock to (e.g. f1d2d2f924e986ac86fdf7b36c94bcdf32beec15). this is a temporary change until an alternative to android-prepare-vendor is built.
  • Loading branch information
dan-v committed Nov 13, 2021
1 parent d49849d commit 14e5c10
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.0.2
12.0.3
25 changes: 25 additions & 0 deletions cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ var (
coreConfigRepo, customConfigRepo string
coreConfigRepoBranch, customConfigRepoBranch string
outputDir string
// TODO: apv workaround - remove once alternative is built
apvRemote, apvBranch, apvRevision string
)

func deployInit() {
Expand Down Expand Up @@ -110,6 +112,16 @@ func deployInit() {
flags.BoolVar(&saveConfig, "save-config", false, "allows you to save all passed CLI flags to config file")

flags.BoolVar(&dryRun, "dry-run", false, "only generate the output files, but do not deploy with terraform.")

// TODO: apv workaround - remove once alternative is built
flags.StringVar(&apvRemote, "apv-remote", "", "remote that contains android-prepare-vendor repo (e.g. https://github.com/example/)")
_ = viper.BindPFlag("apv-remote", flags.Lookup("apv-remote"))

flags.StringVar(&apvBranch, "apv-branch", "", "the branch to use for android-prepare-vendor repo (e.g. 12)")
_ = viper.BindPFlag("apv-branch", flags.Lookup("apv-branch"))

flags.StringVar(&apvRevision, "apv-revision", "", "the git revision to use for android-prepare-vendor repo.")
_ = viper.BindPFlag("apv-revision", flags.Lookup("apv-revision"))
}

var deployCmd = &cobra.Command{
Expand Down Expand Up @@ -147,6 +159,16 @@ var deployCmd = &cobra.Command{
if !supportedDevices.IsSupportedDevice(viper.GetString("device")) {
return fmt.Errorf("must specify a supported device: %v", strings.Join(supportedDevices.GetDeviceCodeNames(), ", "))
}
// TODO: apv workaround - remove once alternative is built
if viper.Get("apv-remote") == "" {
return fmt.Errorf("TEMPORARY: need to specify apv-remote in config (e.g. https://github.com/example/)")
}
if viper.Get("apv-branch") == "" {
return fmt.Errorf("TEMPORARY: need to specify apv-branch in config (e.g. 12)")
}
if viper.Get("apv-revision") == "" {
return fmt.Errorf("TEMPORARY: need to specify apv-revision in config (e.g. f1d2d2f924e986ac86fdf7b36c94bcdf32beec15)")
}

// deprecated checks
if viper.GetBool("encrypted-keys") {
Expand Down Expand Up @@ -226,6 +248,9 @@ var deployCmd = &cobra.Command{
CustomConfigRepoBranch: viper.GetString("custom-config-repo-branch"),
ReleasesURL: viper.GetString("releases-url"),
Cloud: viper.GetString("cloud"),
ApvRemote: viper.GetString("apv-remote"),
ApvBranch: viper.GetString("apv-branch"),
ApvRevision: viper.GetString("apv-revision"),
}

templateRenderer, err := templates.New(templateConfig, templatesFiles, configuredOutputDir)
Expand Down
7 changes: 7 additions & 0 deletions internal/templates/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ type Config struct {
ReleasesURL string
// Cloud specifies which cloud to build on (only aws supported right now)
Cloud string
// TODO: apv workaround - remove once alternative is built
// ApvRemote is the git remote that contains an android-prepare-vendor repo
ApvRemote string
// ApvBranch is the branch to use for the android-prepare-vendor repo
ApvBranch string
// ApvRevision is the revision to lock to for android-prepare-vendor repo
ApvRevision string
}

// Templates provides the ability to render templates and write them to disk
Expand Down
4 changes: 4 additions & 0 deletions templates/generated_vars_and_funcs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ CORE_CONFIG_REPO="<% .CoreConfigRepo %>"
CORE_CONFIG_REPO_BRANCH="<% .CoreConfigRepoBranch %>"
CUSTOM_CONFIG_REPO="<% .CustomConfigRepo %>"
CUSTOM_CONFIG_REPO_BRANCH="<% .CustomConfigRepoBranch %>"
#TODO: apv workaround - remove once alternative is built
APV_REMOTE="<% .ApvRemote %>"
APV_BRANCH="<% .ApvBranch %>"
APV_REVISION="<% .ApvRevision %>"

##########################################
###### CLOUD SPECIFIC VARS AND FUNCS #####
Expand Down

0 comments on commit 14e5c10

Please sign in to comment.