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
GH Action - Run Provisioners #2233
Merged
tomjn
merged 15 commits into
Varying-Vagrant-Vagrants:develop
from
saucal:gh-action-provisioner
Sep 24, 2020
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ba6e81a
Fix issue when all provisioners run on the same shell (test suite)
msaggiorato b76fc87
Leftover continue from when this was in a loop
msaggiorato 6b87a11
Initial approach to the action, create vagrant like environment
msaggiorato edb9b1d
Script that works
msaggiorato 62001bd
Make logs available as artifacts
msaggiorato 64e959f
Attempt with bindfs
msaggiorato 71c4155
Rename file
msaggiorato b9027aa
Fix permission issues, and try to force same permissions as Vagrant does
msaggiorato 2da075e
Separate provisioners to separate steps
msaggiorato d720ea1
Remove bindfs
msaggiorato 3b42ec1
Upload artifacts always
msaggiorato c443939
Properly exit if the provisioner have an exit code other than 0
msaggiorato f7ecae8
Fix conditional. Some provisioners were not executing.
msaggiorato b1c19b1
Use noroot when cloning site provisioner templates
msaggiorato db24fc3
Force everything to have vagrant:vagrant ownership.
msaggiorato File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: VVV Provisioning | ||
|
||
# Controls when the action will run. Triggers the workflow on push or pull request | ||
# events but only for the develop branch | ||
on: | ||
push: | ||
branches: [ develop ] | ||
pull_request: | ||
branches: [ develop, stable ] | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build: | ||
name: Run Provisioner | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-18.04 | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
|
||
# Make Symlinks | ||
- name: Create Vagrant Like Environment | ||
run: | | ||
# uninstall pre installed packages (to test if utilities work) | ||
sudo apt-get -q --autoremove --purge remove php* | ||
sudo apt-get -q autoclean | ||
|
||
# create vagrant user | ||
sudo groupadd -g 2000 vagrant | ||
sudo useradd -u 2000 -g vagrant -m vagrant | ||
|
||
# vvv_symlink function to sumulate synced folders | ||
function vvv_symlink() { | ||
if [ ! -d "${1}" ]; then | ||
sudo mkdir -p "${1}" | ||
fi | ||
sudo chown -R vagrant:vagrant "${1}" | ||
sudo ln -sf "${1}" "${2}" | ||
} | ||
|
||
# create srv folder | ||
sudo -u "vagrant" mkdir -p "/srv" | ||
|
||
# copy files provided by vagrant | ||
sudo cp -f "$GITHUB_WORKSPACE/config/default-config.yml" "$GITHUB_WORKSPACE/config/config.yml" | ||
tomjn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
sudo cp -f "$GITHUB_WORKSPACE/version" "/home/vagrant/version" | ||
|
||
# make folders available | ||
vvv_symlink "$GITHUB_WORKSPACE/database/sql" "/srv/database" | ||
vvv_symlink "$GITHUB_WORKSPACE/config" "/srv/config" | ||
vvv_symlink "$GITHUB_WORKSPACE/provision" "/srv/provision" | ||
vvv_symlink "$GITHUB_WORKSPACE/certificates" "/srv/certificates" | ||
vvv_symlink "$GITHUB_WORKSPACE/www" "/srv/www" | ||
vvv_symlink "$GITHUB_WORKSPACE/log/memcached" "/var/log/memcached" | ||
vvv_symlink "$GITHUB_WORKSPACE/log/nginx" "/var/log/nginx" | ||
vvv_symlink "$GITHUB_WORKSPACE/log/php" "/var/log/php" | ||
vvv_symlink "$GITHUB_WORKSPACE/log/provisioners" "/var/log/provisioners" | ||
|
||
# Runs the provisioners in the expected order | ||
- name: Run provison-pre.sh | ||
run: sudo bash -c '. "/srv/provision/tests/provisioners.sh" && pre_hook' | ||
|
||
- name: Run provison.sh | ||
run: sudo bash -c '. "/srv/provision/tests/provisioners.sh" && provision_main' | ||
|
||
- name: Run provison-dashboard.sh | ||
run: sudo bash -c '. "/srv/provision/tests/provisioners.sh" && provision_dashboard' | ||
|
||
- name: Run provison-utility-source.sh | ||
run: sudo bash -c '. "/srv/provision/tests/provisioners.sh" && provision_utility_sources' | ||
|
||
- name: Run provison-utility.sh | ||
run: sudo bash -c '. "/srv/provision/tests/provisioners.sh" && provision_utilities' | ||
|
||
- name: Run provison-site.sh | ||
run: sudo bash -c '. "/srv/provision/tests/provisioners.sh" && provision_sites' | ||
|
||
- name: Run provison-post.sh | ||
run: sudo bash -c '. "/srv/provision/tests/provisioners.sh" && post_hook' | ||
|
||
# At this point, we would run some extra tests | ||
# TODO: Ideas | ||
# - Add screenshots of provisioned sites | ||
# - CURL mailhog API to see if it's working or not | ||
# - Check VM hostfile | ||
|
||
- name: Prepare Output | ||
if: ${{ always() }} | ||
run: | | ||
sudo cp -rf "$GITHUB_WORKSPACE/log" "/vvv-logs" | ||
MYUID=$(id -u -n) | ||
MYGID=$(id -g -n) | ||
sudo chown -R $MYUID:$MYGID "/vvv-logs" | ||
|
||
- uses: actions/upload-artifact@v2 | ||
if: ${{ always() }} | ||
with: | ||
name: logs | ||
path: "/vvv-logs" |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
To move on this pr we need to test utilities? We can do another issue for that task?
Maybe in the utilities repo?