Skip to content

Commit

Permalink
Merge pull request #18 from lorengordon/tf012
Browse files Browse the repository at this point in the history
Updates to terraform 012 and uses salt s3 endpoint
  • Loading branch information
lorengordon authored Apr 2, 2020
2 parents 4d709de + 1e0146e commit f21eeb0
Show file tree
Hide file tree
Showing 28 changed files with 517 additions and 524 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 3.0.0
current_version = 4.0.0
commit = True
message = Bumps version to {new_version}
tag = False
Expand Down
11 changes: 11 additions & 0 deletions .dependabot/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 1

update_configs:

- package_manager: "terraform"
directory: "/"
update_schedule: "daily"

- package_manager: "docker"
directory: "/"
update_schedule: "daily"
32 changes: 32 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# see http://editorconfig.org
root = true

[*]
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2
charset = utf-8
tab_width = 4

[*.md]
trim_trailing_whitespace = false

[*.py]
indent_size = 4

[go.mod]
indent_style = tab
indent_size = 1

[*.go]
indent_style = tab
indent_size = 1

[Makefile]
indent_style = tab
indent_size = 1

[LICENSE]
indent_size = none
24 changes: 0 additions & 24 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,26 +1,2 @@
# Detect text files and perform LF normalization
* text eol=lf

# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain

#===============
#Personal git ignore settings
#===============
60 changes: 10 additions & 50 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,53 +1,13 @@
# Terraform files
# Terraform compiled files and directories
terraform.tfstate
terraform.tfstate.*
.terraform
terraform.tfstate.d
*.tfstate
*.tfstate.backup
*.tfvars

# Additional project exclusions
.filecache

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp
.terraform.tfstate.*
.terragrunt-cache

# Windows shortcuts
*.lnk

# =========================
# Operating System Files
# =========================

# OSX
# =========================

.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100
.Trashes
# User state
*.tfvars

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# ci
tardigrade-ci
.tardigrade-ci
16 changes: 16 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
pull_request_rules:
- name: automatic approve dependabot pull requests
conditions:
- author~=dependabot\[bot\]|dependabot-preview\[bot\]
- status-success=continuous-integration/travis-ci/pr
actions:
review:
type: APPROVE

- name: automatic merge for dependabot pull requests
conditions:
- author~=dependabot\[bot\]|dependabot-preview\[bot\]
- "#approved-reviews-by>=1"
actions:
merge:
method: merge
64 changes: 27 additions & 37 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,41 @@
language: bash
dist: xenial

env:
global:
- AWS_DEFAULT_REGION="us-east-1"
- REPO="${TRAVIS_REPO_SLUG#*/}"
- OWNER=plus3it
- DEPLOY_SLUG=$OWNER/$REPO
language: node_js

node_js:
- "12"

stages:
- lint
- deploy

jobs:
include:
- stage: test
env:
- JOB="Terraform Format Check"
before_install:
- TERRAFORM_VERSION=$(curl -sSL https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r -M '.current_version')
- TERRAFORM_URL="https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip"
- echo "TERRAFORM_URL=${TERRAFORM_URL}"
- curl -sSL -o terraform.zip "$TERRAFORM_URL"
- unzip terraform.zip && rm -f terraform.zip
- chmod +x terraform
- mkdir -p $HOME/bin
- export PATH=$PATH:$HOME/bin
- mv terraform $HOME/bin
- terraform --version
script:
- terraform fmt -check=true
- stage: lint
name: Project Syntax Verification
script: make && make docker/run target=lint
- stage: deploy
env:
- JOB="Deploy to GitHub Releases"
- PRIOR_VERSION=$(git describe --abbrev=0 --tags)
- RELEASE_VERSION=$(grep current_version $TRAVIS_BUILD_DIR/.bumpversion.cfg | sed 's/^.*= //')
- RELEASE_BODY="* [$REPO v$RELEASE_VERSION changes](https://github.com/$OWNER/$REPO/compare/$PRIOR_VERSION...$RELEASE_VERSION)"
script:
- skip
if: branch = master AND type = push AND repo = plus3it/salt-reposync
before_script:
- |
PRIOR_VERSION=$(git describe --abbrev=0 --tags)
RELEASE_VERSION=$(grep current_version $TRAVIS_BUILD_DIR/.bumpversion.cfg | sed 's/^.*= //' )
RELEASE_BODY="* [SALT-REPOSYNC v$RELEASE_VERSION CHANGELOG](https://github.com/plus3it/salt-reposync/blob/$RELEASE_VERSION/CHANGELOG.md)"
export PRIOR_VERSION RELEASE_VERSION RELEASE_BODY
script: skip
before_deploy:
- echo PRIOR_VERSION=$PRIOR_VERSION
- echo RELEASE_VERSION=$RELEASE_VERSION
- echo RELEASE_BODY=$RELEASE_BODY
- |
(set -x; git tag -a $RELEASE_VERSION -m $RELEASE_VERSION)
deploy:
provider: releases
api_key:
secure: ZVwUe5hN5k2gaOzIpWzC6F/go2gemRRzIe3LtMmuoCFWbO20OulJw9kVuq5moqkZuhMqoQ2ep9SE45QhxRVYXZPd1d2E4sYhES/0XPGL91ssl87xFEkHn1F5uYPLNXSp96ALG9RbJbiqdvHiMuE4bn94AJofb9+63Syt7LnbQCMNs14M6c8xtPaUcngTFhimOrQTNmMlkRpjrPEJ8/jE4eQy2JejqpN2jYLRwli7HlCONwLHCMMkNnmPU7W5VihkcJSu016JmsJ/2YGCGA+SGHXJCrGiOoGyLLMSXusMS03D8KXVxbiWgP6apQLn8YlrAuirLg+s3+x1ECPFWR0grCRydDtdCausl1HfcN4+rWm154nYGi900ypd+aWcYQMSarsSmxCpCn5Nngz6IgJwJALlqCbqmLpg8WJXKxfOeNzI19Wsn/f0Vr3jkqTvR7KqTLpEvMKs11PFxb0z9LKCpkexnIadNl7qRR8lY+ilB0+e2ZMlsmuoDGCGdLD6oLoevH0nStmbNzMNMlZ+ClSNPAg74Em0a8vo1rCNhZPG/H9X0jpKlbn1NDXdDvggewHqO7La+E7+K3dxD5d06pHpfsS6vBrrJJVwrRp9eLvKgAF/3Bebc9eVcOBQdhOA+A6/6LpQ7F4l3rNBzJRY0YDbbU+WFQf4z2xmqDgIOnivK18=
name: $RELEASE_VERSION
tag_name: $RELEASE_VERSION
body: $RELEASE_BODY
tag_name: $RELEASE_VERSION
target_commitish: $TRAVIS_COMMIT
draft: false
api_key:
secure: ZVwUe5hN5k2gaOzIpWzC6F/go2gemRRzIe3LtMmuoCFWbO20OulJw9kVuq5moqkZuhMqoQ2ep9SE45QhxRVYXZPd1d2E4sYhES/0XPGL91ssl87xFEkHn1F5uYPLNXSp96ALG9RbJbiqdvHiMuE4bn94AJofb9+63Syt7LnbQCMNs14M6c8xtPaUcngTFhimOrQTNmMlkRpjrPEJ8/jE4eQy2JejqpN2jYLRwli7HlCONwLHCMMkNnmPU7W5VihkcJSu016JmsJ/2YGCGA+SGHXJCrGiOoGyLLMSXusMS03D8KXVxbiWgP6apQLn8YlrAuirLg+s3+x1ECPFWR0grCRydDtdCausl1HfcN4+rWm154nYGi900ypd+aWcYQMSarsSmxCpCn5Nngz6IgJwJALlqCbqmLpg8WJXKxfOeNzI19Wsn/f0Vr3jkqTvR7KqTLpEvMKs11PFxb0z9LKCpkexnIadNl7qRR8lY+ilB0+e2ZMlsmuoDGCGdLD6oLoevH0nStmbNzMNMlZ+ClSNPAg74Em0a8vo1rCNhZPG/H9X0jpKlbn1NDXdDvggewHqO7La+E7+K3dxD5d06pHpfsS6vBrrJJVwrRp9eLvKgAF/3Bebc9eVcOBQdhOA+A6/6LpQ7F4l3rNBzJRY0YDbbU+WFQf4z2xmqDgIOnivK18=
on:
branch: master
repo: $DEPLOY_SLUG
repo: plus3it/salt-reposync
condition: '"$PRIOR_VERSION" != "$RELEASE_VERSION"'
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM plus3it/tardigrade-ci:0.0.13

WORKDIR /ci-harness
ENTRYPOINT ["make"]
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SHELL := /bin/bash

-include $(shell curl -sSL -o .tardigrade-ci "https://raw.githubusercontent.com/plus3it/tardigrade-ci/master/bootstrap/Makefile.bootstrap"; echo .tardigrade-ci)
45 changes: 32 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,48 @@
# salt-reposync
Pull salt packages for a specific salt version from an rsync yum repo and push
them to S3.
Pull salt packages for specific salt versions from an s3-hosted yum repo and
push them to S3.

## Usage

```
terraform init
terraform plan -var bucket_name=<BUCKET> -var salt_version="SALT_VERSION" -out tfplan
terraform apply -var bucket_name=<BUCKET> -var salt_version="SALT_VERSION" tfplan
terraform plan -var bucket_name=<BUCKET> -var salt_versions='["SALT_VERSION"]' -out tfplan
terraform apply -var bucket_name=<BUCKET> -var salt_versions='["SALT_VERSION"]' tfplan
```

## Prerequisites

1. The `aws` CLI must be installed and available in the PATH.
2. An AWS credential with get/put permissions to the S3 bucket must be pre-
1. An AWS credential with get/put permissions to the S3 bucket must be pre-
configured. Any method supported by the `aws` CLI may be used to configure
the credential.
3. `rsync` must be installed and available and in the PATH.
2. `rclone` must be installed and available and in the PATH.

## Submodules

* `repo` - Uses `rsync` to create a local copy of the salt yum repo for the
salt versions specified by `var.salt_version` and `var.extra_salt_versions`.
The `aws` utility is used to sync the local copy to the S3 bucket specified
by `var.bucket_name`.
* `repo` - Uses `rclone` to create a copy of the salt yum repo for the salt
versions specified by `var.salt_versions`.

* `defs` - Templates the yum repo definition files and uses the `aws` utility
to sync them to the S3 bucket specified by `var.bucket_name`.
* `defs` - Creates yum repo definition files for all `var.salt_versions` in
the S3 bucket specified by `var.bucket_name`.

<!-- BEGIN TFDOCS -->
## Providers

No provider.

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:-----:|
| bucket\_name | S3 bucket where salt repo will be mirrored | `string` | n/a | yes |
| repo\_endpoint | HTTP/S endpoint URL that hosts the yum repos; used with the baseurl in the yum .repo definitions | `string` | n/a | yes |
| repo\_prefix | S3 key prefix where the repos will be mirrored | `string` | `""` | no |
| salt\_s3\_endpoint | S3 endpoint for the upstream salt repo | `string` | `"https://s3.repo.saltstack.com"` | no |
| salt\_versions | List of salt versions to mirror; will also generate version-specific yum .repo definition files | `list(string)` | `[]` | no |
| yum\_prefix | S3 key where the yum repo definitions will be placed | `string` | `""` | no |

## Outputs

No output.

<!-- END TFDOCS -->
Loading

0 comments on commit f21eeb0

Please sign in to comment.