Skip to content

Commit

Permalink
New bootstrap (#1398)
Browse files Browse the repository at this point in the history
* fix bootstrap to support booting v3

* modify all builds to automate for v3
  • Loading branch information
muhamadazmy authored Sep 28, 2021
1 parent d690d87 commit fbd33d0
Show file tree
Hide file tree
Showing 11 changed files with 1,226 additions and 1,218 deletions.
800 changes: 400 additions & 400 deletions .github/workflows/bins-extra-development.yaml

Large diffs are not rendered by default.

796 changes: 398 additions & 398 deletions .github/workflows/bins-extra-pre-release.yaml

Large diffs are not rendered by default.

798 changes: 399 additions & 399 deletions .github/workflows/bins-extra-release.yaml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions .github/workflows/publish-bootstrap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Publish Bootstrap
on:
push:
paths:
- 'bootstrap/bootstrap/**'
- '.github/workflows/publish-bootstrap.yaml'
- "bootstrap/bootstrap/**"
- ".github/workflows/publish-bootstrap.yaml"

jobs:
bootstrap:
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
name: ${{ steps.setname.outputs.build }}
target: bootstrap:development.flist
- name: Symlink flist (release)
if: success() && github.ref == 'refs/heads/master'
if: success() && github.ref == 'refs/heads/main'
uses: threefoldtech/publish-flist@master
with:
action: symlink
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-development.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
target: ${{ steps.setname.outputs.build }}

- name: Crosslink flist (development)
if: success() && github.ref == 'refs/heads/master-3'
if: success() && github.ref == 'refs/heads/main'
uses: threefoldtech/publish-flist@master
with:
token: ${{ secrets.HUB_JWT }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-pre-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
token: ${{ secrets.HUB_JWT }}
action: crosslink
user: tf-zos
name: zos:development:latest.flist
name: zos:development-3:latest.flist
target: tf-autobuilder/zos:${{ github.ref }}.flist

- name: Symlink flist (testing)
Expand All @@ -76,5 +76,5 @@ jobs:
token: ${{ secrets.HUB_JWT }}
action: crosslink
user: tf-zos
name: zos:testing:latest.flist
name: zos:testing-3:latest.flist
target: tf-autobuilder/zos:${{ github.ref }}.flist
6 changes: 3 additions & 3 deletions .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
token: ${{ secrets.HUB_JWT }}
action: crosslink
user: tf-zos
name: zos:development:latest.flist
name: zos:development-3:latest.flist
target: tf-autobuilder/zos:${{ github.ref }}.flist

- name: Symlink flist (testing)
Expand All @@ -77,7 +77,7 @@ jobs:
token: ${{ secrets.HUB_JWT }}
action: crosslink
user: tf-zos
name: zos:testing:latest.flist
name: zos:testing-3:latest.flist
target: tf-autobuilder/zos:${{ github.ref }}.flist

- name: Symlink flist (production)
Expand All @@ -87,5 +87,5 @@ jobs:
token: ${{ secrets.HUB_JWT }}
action: crosslink
user: tf-zos
name: zos:production:latest.flist
name: zos:production-3:latest.flist
target: tf-autobuilder/zos:${{ github.ref }}.flist
23 changes: 15 additions & 8 deletions bootstrap/bootstrap/src/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ use config::{RunMode, Version};
use retry;

const FLIST_REPO: &str = "tf-zos";
const BIN_REPO: &str = "tf-zos-bins";
const BIN_REPO_V2: &str = "tf-zos-bins";
const BIN_REPO_V3: &str = "tf-zos-v3-bins";

const FLIST_INFO_FILE: &str = "/tmp/flist.info";
const FLIST_NAME_FILE: &str = "/tmp/flist.name";
const WORKDIR: &str = "/tmp/bootstrap";
Expand Down Expand Up @@ -128,21 +130,26 @@ pub fn install(cfg: &config::Config) -> Result<()> {
}

fn install_packages(cfg: &config::Config) -> Result<()> {
let name = match cfg.version {
Version::V2 => BIN_REPO_V2,
Version::V3 => BIN_REPO_V3,
};

let repo = match cfg.runmode {
config::RunMode::Prod => BIN_REPO.to_owned(),
config::RunMode::Dev => format!("{}.dev", BIN_REPO),
config::RunMode::Test => format!("{}.test", BIN_REPO),
config::RunMode::Prod => name.into(),
config::RunMode::Dev => format!("{}.dev", name),
config::RunMode::Test => format!("{}.test", name),
};

let client = hub::Repo::new(&repo);
let packages = retry::retry(retry::delay::Exponential::from_millis(200), || {
info!("list packages in: {}", BIN_REPO);
info!("list packages in: {}", BIN_REPO_V2);
//the full point of this match is the logging.
let packages = match client.list() {
Ok(info) => info,
Err(err) => {
error!("failed to list repo '{}': {}", BIN_REPO, err);
bail!("failed to list repo '{}': {}", BIN_REPO, err);
error!("failed to list repo '{}': {}", BIN_REPO_V2, err);
bail!("failed to list repo '{}': {}", BIN_REPO_V2, err);
}
};

Expand All @@ -151,7 +158,7 @@ fn install_packages(cfg: &config::Config) -> Result<()> {

let packages = match packages {
Ok(packages) => packages,
Err(err) => bail!("failed to list '{}': {:?}", BIN_REPO, err),
Err(err) => bail!("failed to list '{}': {:?}", BIN_REPO_V2, err),
};

let mut map = std::collections::HashMap::new();
Expand Down
1 change: 1 addition & 0 deletions bootstrap/etc/zinit/internet.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
exec: internet
oneshot: true
log: stdout
after:
- udev-trigger
6 changes: 3 additions & 3 deletions pkg/environment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,23 @@ var (
RunningMode: RunningDev,
SubstrateURL: SubstrateDefaultURL,
FlistURL: "zdb://hub.grid.tf:9900",
BinRepo: "tf-zos-bins.dev",
BinRepo: "tf-zos-v3-bins.dev",
}

envTest = Environment{
RunningMode: RunningTest,
// TODO: this should become a different substrate ?
SubstrateURL: SubstrateDefaultURL,
FlistURL: "zdb://hub.grid.tf:9900",
BinRepo: "tf-zos-bins.test",
BinRepo: "tf-zos-v3-bins.test",
}

// same as testnet for now. will be updated the day of the launch of production network
envProd = Environment{
RunningMode: RunningMain,
SubstrateURL: SubstrateDefaultURL,
FlistURL: "zdb://hub.grid.tf:9900",
BinRepo: "tf-zos-bins",
BinRepo: "tf-zos-v3-bins",
}
)

Expand Down
2 changes: 1 addition & 1 deletion qemu/overlay/etc/zinit/bootstrap.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Override the default bootstrap procedure
# embedded in the image if using overlay
exec: "true"
exec: /sbin/bootstrap -d
oneshot: true
after:
- internet

0 comments on commit fbd33d0

Please sign in to comment.