build major docker images, change fast forward params
This commit is contained in:
parent
6fda40ab6d
commit
21080610a7
2 changed files with 11 additions and 13 deletions
3
build
3
build
|
@ -2,6 +2,7 @@
|
||||||
# Create all the different builds for refractr
|
# Create all the different builds for refractr
|
||||||
|
|
||||||
version=$(cat Cargo.toml | grep -m1 version | awk -F' ' '{print $3}' | sed 's|"||g')
|
version=$(cat Cargo.toml | grep -m1 version | awk -F' ' '{print $3}' | sed 's|"||g')
|
||||||
|
major_version=$(echo $version | awk -F'.' '{print $1}')
|
||||||
uid=$(id -u)
|
uid=$(id -u)
|
||||||
gid=$(id -g)
|
gid=$(id -g)
|
||||||
cargo update
|
cargo update
|
||||||
|
@ -13,9 +14,11 @@ docker tag refractr:$version refractr:latest
|
||||||
if test "$1" = "push"; then
|
if test "$1" = "push"; then
|
||||||
docker tag refractr:$version git.brysonsteck.xyz/brysonsteck/refractr:latest
|
docker tag refractr:$version git.brysonsteck.xyz/brysonsteck/refractr:latest
|
||||||
docker tag refractr:$version git.brysonsteck.xyz/brysonsteck/refractr:$version
|
docker tag refractr:$version git.brysonsteck.xyz/brysonsteck/refractr:$version
|
||||||
|
docker tag refractr:$version git.brysonsteck.xyz/brysonsteck/refractr:$major_version
|
||||||
docker push -a git.brysonsteck.xyz/brysonsteck/refractr
|
docker push -a git.brysonsteck.xyz/brysonsteck/refractr
|
||||||
docker image rm git.brysonsteck.xyz/brysonsteck/refractr:latest
|
docker image rm git.brysonsteck.xyz/brysonsteck/refractr:latest
|
||||||
docker image rm git.brysonsteck.xyz/brysonsteck/refractr:$version
|
docker image rm git.brysonsteck.xyz/brysonsteck/refractr:$version
|
||||||
|
docker image rm git.brysonsteck.xyz/brysonsteck/refractr:$major_version
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# rust build
|
# rust build
|
||||||
|
|
|
@ -33,7 +33,6 @@ pub struct Refractr {
|
||||||
|
|
||||||
struct OpenedRepository {
|
struct OpenedRepository {
|
||||||
repo: Repository,
|
repo: Repository,
|
||||||
path: String,
|
|
||||||
remotes: Vec<String>,
|
remotes: Vec<String>,
|
||||||
cfg: Config,
|
cfg: Config,
|
||||||
ssh: bool,
|
ssh: bool,
|
||||||
|
@ -91,9 +90,7 @@ impl Refractr {
|
||||||
refs_branches
|
refs_branches
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fast_forward(&self, repo_dir: &str, branches: &Vec<String>) -> Result<(), Error> {
|
fn fast_forward(&self, repo: &Repository, branches: &Vec<String>) -> Result<(), Error> {
|
||||||
let repo = Repository::open(repo_dir)?;
|
|
||||||
|
|
||||||
common::verbose(self.verbose, 2, format!("Pulling origin"));
|
common::verbose(self.verbose, 2, format!("Pulling origin"));
|
||||||
repo.find_remote("origin")?.fetch(&branches, None, None)?;
|
repo.find_remote("origin")?.fetch(&branches, None, None)?;
|
||||||
|
|
||||||
|
@ -301,7 +298,7 @@ impl Refractr {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let _ = self.fast_forward(&repos[i].path, &repos[i].cfg.branches);
|
let _ = self.fast_forward(&repos[i].repo, &repos[i].cfg.branches);
|
||||||
if let Err(e) = self.push_remotes(&repos[i].cfg, &repos[i].repo, &repos[i].remotes) {
|
if let Err(e) = self.push_remotes(&repos[i].cfg, &repos[i].repo, &repos[i].remotes) {
|
||||||
common::error(e, ExitCode::PushError)
|
common::error(e, ExitCode::PushError)
|
||||||
};
|
};
|
||||||
|
@ -406,16 +403,15 @@ impl Refractr {
|
||||||
"found existing repo at {}, attempting to use",
|
"found existing repo at {}, attempting to use",
|
||||||
repo_dir
|
repo_dir
|
||||||
));
|
));
|
||||||
match self.fast_forward(&repo_dir, &cfg.config.branches) {
|
match Repository::open(Path::new(&repo_dir)) {
|
||||||
Ok(_) => {
|
Ok(r) => match self.fast_forward(&r, &cfg.config.branches) {
|
||||||
if let Ok(repo) = Repository::open(Path::new(&repo_dir)) {
|
Ok(_) => r,
|
||||||
repo
|
Err(e) => {
|
||||||
} else {
|
|
||||||
return Err(ReturnData {
|
return Err(ReturnData {
|
||||||
code: ExitCode::RepositoryError,
|
code: ExitCode::RepositoryError,
|
||||||
msg: format!("failed to obtain existing repo"),
|
msg: format!("failed to fast forward existing repo: {}", e),
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
return Err(ReturnData {
|
return Err(ReturnData {
|
||||||
|
@ -462,7 +458,6 @@ impl Refractr {
|
||||||
if cfg.config.schedule.enabled {
|
if cfg.config.schedule.enabled {
|
||||||
loop_repos.push(OpenedRepository {
|
loop_repos.push(OpenedRepository {
|
||||||
repo,
|
repo,
|
||||||
path: repo_dir,
|
|
||||||
remotes,
|
remotes,
|
||||||
cfg: cfg.config,
|
cfg: cfg.config,
|
||||||
ssh,
|
ssh,
|
||||||
|
|
Loading…
Add table
Reference in a new issue