-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from lorengordon/archive-race
- Loading branch information
Showing
14 changed files
with
170 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
[bumpversion] | ||
current_version = 4.0.1 | ||
current_version = 5.0.0 | ||
commit = True | ||
message = Bumps version to {new_version} | ||
tag = False | ||
tag_name = {new_version} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
module "sync_repo" { | ||
source = "./modules/repo" | ||
|
||
bucket_name = var.bucket_name | ||
salt_versions = var.salt_versions | ||
repo_prefix = var.repo_prefix | ||
salt_s3_endpoint = var.salt_s3_endpoint | ||
bucket_name = var.bucket_name | ||
repos = var.repos | ||
} | ||
|
||
module "yum_defs" { | ||
source = "./modules/defs" | ||
|
||
bucket_name = var.bucket_name | ||
salt_versions = var.salt_versions | ||
repo_endpoint = var.repo_endpoint | ||
repo_prefix = var.repo_prefix | ||
yum_prefix = var.yum_prefix | ||
repos = var.repos | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,85 @@ | ||
locals { | ||
disable = length(var.salt_versions) == 0 | ||
salt_versions = formatlist("--filter '+ {amazon,redhat}/{latest,?}/**/archive/%s/**'", sort(var.salt_versions)) | ||
repo_prefix_python2 = "${trim(var.repo_prefix, "/")}/python2" | ||
repo_prefix_python3 = "${trim(var.repo_prefix, "/")}/python3" | ||
} | ||
repos = [ | ||
for repo in var.repos : { | ||
id = "${repo.salt_s3_endpoint}_${repo.repo_prefix}" | ||
repo_prefix_python2 = "${trim(repo.repo_prefix, "/")}/python2" | ||
repo_prefix_python3 = "${trim(repo.repo_prefix, "/")}/python3" | ||
salt_s3_endpoint = repo.salt_s3_endpoint | ||
salt_versions = formatlist("--filter '+ {amazon,redhat}/{latest,?}/**/archive/%s/**'", sort(repo.salt_versions)) | ||
} | ||
] | ||
|
||
locals { | ||
rclone_base = [ | ||
"RCLONE_CONFIG_SALT_TYPE=s3", | ||
"RCLONE_CONFIG_SALT_PROVIDER=Other", | ||
"RCLONE_CONFIG_SALT_ENV_AUTH=false", | ||
"RCLONE_CONFIG_SALT_ENDPOINT=${var.salt_s3_endpoint}", | ||
"RCLONE_CONFIG_SALT_ENDPOINT=%s", # %s is repo.salt_s3_endpoint | ||
"RCLONE_CONFIG_S3_TYPE=s3", | ||
"RCLONE_CONFIG_S3_ENV_AUTH=true", | ||
"rclone sync", | ||
"--delete-excluded --use-server-modtime --update --fast-list -v", | ||
"--filter '- **/{i386,i686,SRPMS}/**'", | ||
join(" ", local.salt_versions), | ||
"%s", # %s is repo.salt_versions | ||
"--filter '- *'", | ||
] | ||
|
||
rclone_python2 = concat( | ||
local.rclone_base, | ||
list( | ||
"salt:s3/yum", # rclone source | ||
"s3:${var.bucket_name}/${local.repo_prefix_python2}" # rclone target | ||
"salt:s3/yum", # rclone source | ||
"s3:${var.bucket_name}/%s" # rclone target, %s is repo.repo_prefix_python2 | ||
) | ||
) | ||
|
||
rclone_python3 = concat( | ||
local.rclone_base, | ||
list( | ||
"salt:s3/py3", # rclone source | ||
"s3:${var.bucket_name}/${local.repo_prefix_python3}" # rclone target | ||
"salt:s3/py3", # rclone source | ||
"s3:${var.bucket_name}/%s" # rclone target, %s is repo.repo_prefix_python3 | ||
) | ||
) | ||
} | ||
|
||
resource "null_resource" "sync_python2" { | ||
count = local.disable ? 0 : 1 | ||
for_each = { for repo in local.repos : repo.id => repo } | ||
|
||
provisioner "local-exec" { | ||
command = join(" ", local.rclone_python2) | ||
command = format( | ||
join(" ", local.rclone_python2), | ||
each.value.salt_s3_endpoint, | ||
join(" ", each.value.salt_versions), | ||
each.value.repo_prefix_python2, | ||
) | ||
} | ||
|
||
triggers = { | ||
rclone = join(" ", local.rclone_python2) | ||
rclone = format( | ||
join(" ", local.rclone_python2), | ||
each.value.salt_s3_endpoint, | ||
join(" ", each.value.salt_versions), | ||
each.value.repo_prefix_python2, | ||
) | ||
} | ||
} | ||
|
||
resource "null_resource" "sync_python3" { | ||
count = local.disable ? 0 : 1 | ||
for_each = { for repo in local.repos : repo.id => repo } | ||
|
||
provisioner "local-exec" { | ||
command = join(" ", local.rclone_python3) | ||
command = format( | ||
join(" ", local.rclone_python3), | ||
each.value.salt_s3_endpoint, | ||
join(" ", each.value.salt_versions), | ||
each.value.repo_prefix_python3, | ||
) | ||
} | ||
|
||
triggers = { | ||
rclone = join(" ", local.rclone_python3) | ||
rclone = format( | ||
join(" ", local.rclone_python3), | ||
each.value.salt_s3_endpoint, | ||
join(" ", each.value.salt_versions), | ||
each.value.repo_prefix_python3, | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,6 @@ module "main" { | |
source = "../.." | ||
|
||
bucket_name = "foo" | ||
salt_versions = [] | ||
repo_endpoint = "bar" | ||
repos = [] | ||
} |
Oops, something went wrong.