-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvement GitHub Actions / Fix admin user existing #20
Changes from all commits
78a230d
b189690
05a136b
02fb008
b31ad85
b11e39a
12b91c4
2d00271
41a17da
f2fb4db
06a6967
36e84e8
36d2032
1010680
f94d582
250bcb1
d7c5baf
8a7339b
55ec7b9
8c06fdc
170349b
6e1ec70
2931243
567f171
d67acd4
17e93fc
30f57f0
c236191
5cbce59
db82028
d13017d
87e3a78
b37fe3a
478df79
66de200
d764e2a
7d434d6
1f3c6c1
5e34fd8
b09c062
22af38c
e843150
7ee9309
d339022
acc7681
882e81e
76f04ef
15c30c0
fb92c21
b2643e5
cbeff8b
fc68cf1
6a01198
c5df4ed
190aa09
f2fd977
cb50101
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
name: build | ||
|
||
on: | ||
push: | ||
|
||
env: | ||
CURL_CACHE_DIR: $HOME/.cache/curl | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.7 | ||
- name: Setup cache # GitHub support coming soon | ||
run: mkdir -p $CURL_CACHE_DIR | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install --upgrade -r requirements-test.txt | ||
- name: Run linters on all files | ||
run: pre-commit run --all-files | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: cisagov/setup-env-github-action@develop | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.7 | ||
- name: Setup cache # GitHub support coming soon | ||
run: mkdir -p $CURL_CACHE_DIR | ||
- name: Install Packer | ||
run: | | ||
PACKER_ZIP="packer_${PACKER_VERSION}_linux_amd64.zip" | ||
curl --output "${CURL_CACHE_DIR}/${PACKER_ZIP}" \ | ||
--time-cond "${CURL_CACHE_DIR}/${PACKER_ZIP}" --location \ | ||
"https://releases.hashicorp.com/packer/${PACKER_VERSION}/${PACKER_ZIP}" | ||
sudo unzip -o -d /usr/local/bin "${CURL_CACHE_DIR}/${PACKER_ZIP}" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install --upgrade -r requirements-test.txt | ||
- name: Validate Packer configuration | ||
run: packer validate src/packer.json | ||
- name: Run tests | ||
env: | ||
GITHUB_RELEASE_TAG: ${{ github.event.release.tag_name }} | ||
run: pytest |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
name: prerelease | ||
|
||
on: | ||
release: | ||
types: [prereleased] | ||
|
||
env: | ||
AWS_DEFAULT_REGION: us-east-2 | ||
BUILD_REGION: us-east-2 | ||
CURL_CACHE_DIR: $HOME/.cache/curl | ||
DEPLOY_REGION_KMS_MAP: "us-east-2:alias/cool/ebs" | ||
|
||
jobs: | ||
prerelease: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: cisagov/setup-env-github-action@develop | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.7 | ||
- name: Setup cache # GitHub support coming soon | ||
run: mkdir -p $CURL_CACHE_DIR | ||
- name: Install Packer | ||
run: | | ||
PACKER_ZIP="packer_${PACKER_VERSION}_linux_amd64.zip" | ||
curl --output "${CURL_CACHE_DIR}/${PACKER_ZIP}" \ | ||
--time-cond "${CURL_CACHE_DIR}/${PACKER_ZIP}" --location \ | ||
"https://releases.hashicorp.com/packer/${PACKER_VERSION}/${PACKER_ZIP}" | ||
sudo unzip -o -d /usr/local/bin "${CURL_CACHE_DIR}/${PACKER_ZIP}" | ||
- name: Install Terraform | ||
run: | | ||
TERRAFORM_ZIP="terraform_${TERRAFORM_VERSION}_linux_amd64.zip" | ||
curl --output "${CURL_CACHE_DIR}/${TERRAFORM_ZIP}" \ | ||
--time-cond "${CURL_CACHE_DIR}/${TERRAFORM_ZIP}" --location \ | ||
"https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/${TERRAFORM_ZIP}" | ||
sudo unzip -d /opt/terraform "${CURL_CACHE_DIR}/${TERRAFORM_ZIP}" | ||
sudo ln -s /opt/terraform/terraform /usr/bin/terraform | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install --upgrade -r requirements.txt | ||
- name: Install ansible roles | ||
run: ansible-galaxy install --force --role-file src/requirements.yml | ||
- name: Patch Packer configuration | ||
run: | | ||
echo $DEPLOY_REGION_KMS_MAP | \ | ||
./patch_packer_config.py src/packer.json | ||
- name: Create machine image | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
GITHUB_IS_PRERELEASE: ${{ github.event.release.prerelease }} | ||
GITHUB_RELEASE_TAG: ${{ github.event.release.tag_name }} | ||
GITHUB_RELEASE_URL: ${{ github.event.release.html_url }} | ||
run: packer build --timestamp-ui src/packer.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
name: release | ||
|
||
on: | ||
release: | ||
types: [released] | ||
|
||
env: | ||
AWS_DEFAULT_REGION: us-east-2 | ||
BUILD_REGION: us-east-2 | ||
CURL_CACHE_DIR: $HOME/.cache/curl | ||
DEPLOY_REGION_KMS_MAP: "us-east-1:alias/cool/ebs, | ||
us-east-2:alias/cool/ebs, | ||
us-west-1:alias/cool/ebs, | ||
us-west-2:alias/cool/ebs" | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: cisagov/setup-env-github-action@develop | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.7 | ||
- name: Setup cache # GitHub support coming soon | ||
run: mkdir -p $CURL_CACHE_DIR | ||
- name: Install Packer | ||
run: | | ||
PACKER_ZIP="packer_${PACKER_VERSION}_linux_amd64.zip" | ||
curl --output "${CURL_CACHE_DIR}/${PACKER_ZIP}" \ | ||
--time-cond "${CURL_CACHE_DIR}/${PACKER_ZIP}" --location \ | ||
"https://releases.hashicorp.com/packer/${PACKER_VERSION}/${PACKER_ZIP}" | ||
sudo unzip -o -d /usr/local/bin "${CURL_CACHE_DIR}/${PACKER_ZIP}" | ||
- name: Install Terraform | ||
run: | | ||
TERRAFORM_ZIP="terraform_${TERRAFORM_VERSION}_linux_amd64.zip" | ||
curl --output "${CURL_CACHE_DIR}/${TERRAFORM_ZIP}" \ | ||
--time-cond "${CURL_CACHE_DIR}/${TERRAFORM_ZIP}" --location \ | ||
"https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/${TERRAFORM_ZIP}" | ||
sudo unzip -d /opt/terraform "${CURL_CACHE_DIR}/${TERRAFORM_ZIP}" | ||
sudo ln -s /opt/terraform/terraform /usr/bin/terraform | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install --upgrade -r requirements.txt | ||
- name: Install ansible roles | ||
run: ansible-galaxy install --force --role-file src/requirements.yml | ||
- name: Patch Packer configuration | ||
run: | | ||
echo $DEPLOY_REGION_KMS_MAP | \ | ||
./patch_packer_config.py src/packer.json | ||
- name: Create machine image | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
GITHUB_IS_PRERELEASE: ${{ github.event.release.prerelease }} | ||
GITHUB_RELEASE_TAG: ${{ github.event.release.tag_name }} | ||
GITHUB_RELEASE_URL: ${{ github.event.release.html_url }} | ||
run: packer build --timestamp-ui src/packer.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,13 +23,13 @@ repos: | |
- id: requirements-txt-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/igorshubovych/markdownlint-cli | ||
rev: v0.18.0 | ||
rev: v0.19.0 | ||
hooks: | ||
- id: markdownlint | ||
args: | ||
- --config=.mdl_config.json | ||
- repo: https://github.com/adrienverge/yamllint | ||
rev: v1.17.0 | ||
rev: v1.18.0 | ||
hooks: | ||
- id: yamllint | ||
- repo: https://github.com/detailyang/pre-commit-shell | ||
|
@@ -43,7 +43,7 @@ repos: | |
additional_dependencies: | ||
- flake8-docstrings | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v1.23.0 | ||
rev: v1.25.1 | ||
hooks: | ||
- id: pyupgrade | ||
# Run bandit on "tests" tree with a configuration | ||
|
@@ -57,7 +57,7 @@ repos: | |
- --config=.bandit.yml | ||
# Run bandit everything but tests directory | ||
- repo: https://github.com/PyCQA/bandit | ||
rev: 2a1dbab | ||
rev: 1.6.2 | ||
hooks: | ||
- id: bandit | ||
name: bandit (everything else) | ||
|
@@ -67,7 +67,7 @@ repos: | |
hooks: | ||
- id: black | ||
- repo: https://github.com/ansible/ansible-lint.git | ||
rev: v4.1.1a0 | ||
rev: 7a2221a32968f12bee8494caf978ce150ad1494f | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you open an issue to remind us to change this back to a release (when one becomes available)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm going to backport this change up to skeleton-generic. I'll modify the issue that is up there: cisagov/skeleton-generic#19 |
||
hooks: | ||
- id: ansible-lint | ||
# files: molecule/default/playbook.yml | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the install of packer and terraform be broken out into a separate repo a la what you did with cisagov/setup-env-github-action?
Seems maybe the Ansible role stuff could possibly be broken out as well, taking the list of role names as an input.