build major docker images, change fast forward params

This commit is contained in:
Bryson Steck 2025-03-23 22:27:22 -06:00
parent 6fda40ab6d
commit 21080610a7
Signed by: bryson
SSH key fingerprint: SHA256:XpKABw/nP4z8UVaH+weLaBnEOD86+cVwif+QjuYLGT4
2 changed files with 11 additions and 13 deletions

3
build
View file

@ -2,6 +2,7 @@
# Create all the different builds for refractr
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)
gid=$(id -g)
cargo update
@ -13,9 +14,11 @@ docker tag refractr:$version refractr:latest
if test "$1" = "push"; then
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:$major_version
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:$version
docker image rm git.brysonsteck.xyz/brysonsteck/refractr:$major_version
fi
# rust build

View file

@ -33,7 +33,6 @@ pub struct Refractr {
struct OpenedRepository {
repo: Repository,
path: String,
remotes: Vec<String>,
cfg: Config,
ssh: bool,
@ -91,9 +90,7 @@ impl Refractr {
refs_branches
}
fn fast_forward(&self, repo_dir: &str, branches: &Vec<String>) -> Result<(), Error> {
let repo = Repository::open(repo_dir)?;
fn fast_forward(&self, repo: &Repository, branches: &Vec<String>) -> Result<(), Error> {
common::verbose(self.verbose, 2, format!("Pulling origin"));
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) {
common::error(e, ExitCode::PushError)
};
@ -406,16 +403,15 @@ impl Refractr {
"found existing repo at {}, attempting to use",
repo_dir
));
match self.fast_forward(&repo_dir, &cfg.config.branches) {
Ok(_) => {
if let Ok(repo) = Repository::open(Path::new(&repo_dir)) {
repo
} else {
match Repository::open(Path::new(&repo_dir)) {
Ok(r) => match self.fast_forward(&r, &cfg.config.branches) {
Ok(_) => r,
Err(e) => {
return Err(ReturnData {
code: ExitCode::RepositoryError,
msg: format!("failed to obtain existing repo"),
msg: format!("failed to fast forward existing repo: {}", e),
});
}
},
},
Err(e) => {
return Err(ReturnData {
@ -462,7 +458,6 @@ impl Refractr {
if cfg.config.schedule.enabled {
loop_repos.push(OpenedRepository {
repo,
path: repo_dir,
remotes,
cfg: cfg.config,
ssh,