Skip to content

Commit

Permalink
Bug 1898394 - Use gecko-dev repo for Fenix and Focus Android manifests
Browse files Browse the repository at this point in the history
Firefox 125 was the last version to use the
@mozilla-mobile/firefox-android repo. Now it is in mozilla-central, so
we can use the @mozilla/gecko-dev mirror. Unfortunately, gecko-dev does
not have tagged releases, so we cannot look up manifests by their
version and have to use --ref instead.

Additionally, we were looking for Fenix manifests in the
@mozilla-mobile/fenix repo for version < 110. However, v110 was released
from the fenix repo and v111 was the first version to use the combnined
@mozilla-mobile/firefox-android repo. This has been updated.
  • Loading branch information
brennie committed Aug 19, 2024
1 parent c3774b2 commit df56260
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 17 deletions.
42 changes: 30 additions & 12 deletions components/support/nimbus-cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,27 +145,37 @@ impl NimbusApp {
version: &Option<String>,
ref_: &String,
) -> Result<String> {
if version.is_none() {
return Ok(ref_.to_string());
}
let app_name = self
.app_name()
.ok_or_else(|| anyhow::anyhow!("Either an --app or a --manifest must be specified"))?;

if version.is_none() {
// gecko-dev uses master, not main
if (app_name == "fenix" || app_name == "focus_android") && ref_ == "main" {
return Ok("master".into());
}

return Ok(ref_.to_string());
}

let v = version.as_ref().unwrap();
let v = match app_name.as_str() {
"fenix" => {
if is_before(version, 110) {
if is_before(version, 111) {
pad_major_minor_patch(v)
} else {
} else if is_before(version, 126) {
pad_major(v)
} else {
bail!("gecko-dev does not have tagged versions, use --ref instead")
}
}
"focus_android" => {
if is_before(version, 110) {
pad_major_minor(v)
} else {
} else if is_before(version, 126) {
pad_major(v)
} else {
bail!("gecko-dev does not have tagged versions, use --ref instead")
}
}
"firefox_ios" => {
Expand Down Expand Up @@ -202,17 +212,21 @@ impl NimbusApp {
Ok(match app_name.as_str() {
// Fenix and Focus are both in the same repo
"fenix" => {
if is_before(version, 110) {
if is_before(version, 111) {
"mozilla-mobile/fenix"
} else {
} else if is_before(version, 126) {
"mozilla-mobile/firefox-android"
} else {
"mozilla/gecko-dev"
}
}
"focus_android" => {
if is_before(version, 110) {
"mozilla-mobile/focus-android"
} else {
} else if is_before(version, 126) {
"mozilla-mobile/firefox-android"
} else {
"mozilla/gecko-dev"
}
}
"firefox_ios" => "mozilla-mobile/firefox-ios",
Expand All @@ -229,12 +243,14 @@ impl NimbusApp {
"fenix" => {
if is_before(version, 98) {
bail!("Fenix wasn't Nimbus enabled before v98")
} else if is_before(version, 110) {
} else if is_before(version, 111) {
"nimbus.fml.yaml"
} else if is_before(version, 112) {
"fenix/nimbus.fml.yaml"
} else {
} else if is_before(version, 126) {
"fenix/app/nimbus.fml.yaml"
} else {
"mobile/android/fenix/app/nimbus.fml.yaml"
}
}
"focus_android" => {
Expand All @@ -244,8 +260,10 @@ impl NimbusApp {
"nimbus.fml.yaml"
} else if is_before(version, 112) {
"focus-android/nimbus.fml.yaml"
} else {
} else if is_before(version, 126) {
"focus-android/app/nimbus.fml.yaml"
} else {
"mobile/android/focus-android/app/nimbus.fml.yaml"
}
}
"firefox_ios" => {
Expand Down
19 changes: 14 additions & 5 deletions components/support/nimbus-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -700,15 +700,24 @@ mod unit_tests {
NimbusApp::new("fenix", "developer")
}

fn fenix_old_manifest_with_ref(ref_: &str) -> ManifestSource {
ManifestSource::FromGithub {
channel: "developer".into(),
github_repo: "mozilla-mobile/firefox-android".into(),
ref_: ref_.into(),
manifest_file: "@mozilla-mobile/firefox-android/fenix/app/nimbus.fml.yaml".into(),
}
}

fn fenix_manifest() -> ManifestSource {
fenix_manifest_with_ref("main")
fenix_manifest_with_ref("master")
}

fn fenix_manifest_with_ref(ref_: &str) -> ManifestSource {
ManifestSource::FromGithub {
github_repo: "mozilla-mobile/firefox-android".to_string(),
github_repo: "mozilla/gecko-dev".to_string(),
ref_: ref_.to_string(),
manifest_file: "@mozilla-mobile/firefox-android/fenix/app/nimbus.fml.yaml".to_string(),
manifest_file: "@mozilla/gecko-dev/mobile/android/fenix/app/nimbus.fml.yaml".into(),
channel: "developer".to_string(),
}
}
Expand Down Expand Up @@ -1090,7 +1099,7 @@ mod unit_tests {
let expected = vec![
AppCommand::ValidateExperiment {
params: fenix_params(),
manifest: fenix_manifest_with_ref("releases_v114"),
manifest: fenix_old_manifest_with_ref("releases_v114"),
experiment: experiment("my-experiment"),
},
AppCommand::NoOp,
Expand Down Expand Up @@ -1206,7 +1215,7 @@ mod unit_tests {
let expected = vec![
AppCommand::ValidateExperiment {
params: fenix_params(),
manifest: fenix_manifest_with_ref("releases_v114"),
manifest: fenix_old_manifest_with_ref("releases_v114"),
experiment: feature_experiment(
"my-feature",
&["./my-branch.json", "./my-treatment.json"],
Expand Down

0 comments on commit df56260

Please sign in to comment.