Clean up workflows and scripts

This commit is contained in:
Chris Roberts 2022-10-26 16:37:08 -07:00
parent d5d925a78f
commit 479a0c60d0
9 changed files with 70 additions and 70 deletions

View File

@ -6,10 +6,10 @@ root="$( cd -P "$( dirname "$csource" )/../" && pwd )"
. "${root}/.ci/init.sh"
pushd "${root}" > "${output}"
pushd "${root}"
# Build our gem
wrap gem build *.gemspec \
wrap gem build ./*.gemspec \
"Failed to build Vagrant RubyGem"
# Get the path of our new gem

View File

@ -1,7 +1,5 @@
#!/usr/bin/env bash
ghr_version="0.13.0"
# NOTE: This release will generate a new release on the installers
# repository which in turn triggers a full package build
target_owner="hashicorp"
@ -13,15 +11,10 @@ root="$( cd -P "$( dirname "$csource" )/../" && pwd )"
. "${root}/.ci/init.sh"
pushd "${root}" > "${output}" 2>&1
pushd "${root}"
# Install ghr
wrap curl -Lso /tmp/ghr.tgz "https://github.com/tcnksm/ghr/releases/download/v${ghr_version}/ghr_v${ghr_version}_linux_amd64.tar.gz" \
"Failed to download ghr utility"
wrap tar -C /tmp/ -xf /tmp/ghr.tgz \
"Failed to unpack ghr archive"
wrap mv "/tmp/ghr_v${ghr_version}_linux_amd64/ghr" "${root}/.ci/" \
"Failed to install ghr utility"
install_ghr
# Build our gem
wrap gem build ./*.gemspec \
@ -29,7 +22,7 @@ wrap gem build ./*.gemspec \
# Get the path of our new gem
g=(vagrant*.gem)
gem=$(printf "%s" "${g}")
gem=$(printf "%s" "${g[0]}")
# Determine the version of the release
vagrant_version="$(gem specification "${gem}" version)"
@ -91,16 +84,17 @@ repo_owner="${target_owner}"
repo_name="${target_repository}"
full_sha="main"
# Use the hashibot token since we are creating the (pre)release
# in a different repository.
export GITHUB_TOKEN="${HASHIBOT_TOKEN}"
if [ "${tag}" = "" ]; then
if [ -z "${tag}" ]; then
echo "Generating Vagrant RubyGem pre-release... "
version="v${vagrant_version}+${short_sha}"
prerelease "${version}" ./release-assets
else
# Validate this is a proper release version
valid_release_version "${vagrant_version}"
if [ $? -ne 0 ]; then
if ! valid_release_version "${vagrant_version}"; then
fail "Invalid version format for Vagrant release: ${vagrant_version}"
fi

View File

@ -10,7 +10,7 @@ jobs:
build-gem:
if: github.repository == 'hashicorp/vagrant'
name: Build Vagrant RubyGem
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- name: Code Checkout
uses: actions/checkout@v1
@ -26,19 +26,7 @@ jobs:
run: ./.ci/build.sh
working-directory: ${{github.workspace}}
env:
ASSETS_LONGTERM_PREFIX: elt
ASSETS_PRIVATE_BUCKET: ${{ secrets.ASSETS_PRIVATE_BUCKET }}
ASSETS_PRIVATE_LONGTERM: ${{ secrets.ASSETS_PRIVATE_LONGTERM }}
ASSETS_PRIVATE_SHORTTERM: ${{ secrets.ASSETS_PRIVATE_SHORTTERM }}
ASSETS_PUBLIC_BUCKET: ${{ secrets.ASSETS_PUBLIC_BUCKET }}
ASSETS_PUBLIC_LONGTERM: ${{ secrets.ASSETS_PUBLIC_LONGTERM }}
ASSETS_PUBLIC_SHORTTERM: ${{ secrets.ASSETS_PUBLIC_SHORTTERM }}
ASSETS_SHORTTERM_PREFIX: est
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ASSUME_ROLE_ARN: ${{ secrets.AWS_ROLE_ARN }}
HASHIBOT_EMAIL: ${{ secrets.HASHIBOT_EMAIL }}
HASHIBOT_TOKEN: ${{ secrets.HASHIBOT_TOKEN }}
HASHIBOT_USERNAME: ${{ secrets.HASHIBOT_USERNAME }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
VAGRANT_CI_LOADER_BUCKET: ${{ secrets.VAGRANT_CI_LOADER_BUCKET }}

View File

@ -7,25 +7,17 @@ on:
jobs:
sync-acceptance:
if: github.repository == 'hashicorp/vagrant'
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- name: Code Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0
- name: Set Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6'
- name: Sync Acceptance Testing Repository
run: ./.ci/sync.sh
working-directory: ${{github.workspace}}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ASSUME_ROLE_ARN: ${{ secrets.AWS_ROLE_ARN }}
HASHIBOT_TOKEN: ${{ secrets.HASHIBOT_TOKEN }}
HASHIBOT_USERNAME: ${{ secrets.HASHIBOT_USERNAME }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
VAGRANT_CI_LOADER_BUCKET: ${{ secrets.VAGRANT_CI_LOADER_BUCKET }}

View File

@ -15,7 +15,7 @@ on:
jobs:
vagrant-spec-tests:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
strategy:
matrix:
go: ['^1.16']
@ -23,7 +23,7 @@ jobs:
name: Vagrant acceptance tests
steps:
- name: Code Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: 'recursive'
# Also fetch all tags, since we need our version number in the build
@ -37,10 +37,7 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{matrix.ruby}}
- name: Setup ruby vagrant
run: |
gem install --no-document bundler
bundle install
bundler-cache: true
- name: Build Vagrant
run: |
git config --global url."https://${HASHIBOT_USERNAME}:${HASHIBOT_TOKEN}@github.com".insteadOf "https://github.com"

View File

@ -22,7 +22,7 @@ on:
jobs:
unit-tests-go:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
strategy:
matrix:
go: ['^1.16']
@ -30,7 +30,7 @@ jobs:
name: Vagrant unit tests on Go
steps:
- name: Code Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
@ -39,10 +39,7 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{matrix.ruby}}
- name: Setup ruby vagrant
run: |
gem install --no-document bundler
bundle install
bundler-cache: true
- name: Get dependencies
run: |
git config --global url."https://${HASHIBOT_USERNAME}:${HASHIBOT_TOKEN}@github.com".insteadOf "https://github.com"

View File

@ -9,11 +9,12 @@ on:
jobs:
trigger-release:
if: github.repository == 'hashicorp/vagrant'
name: Trigger Installers Build
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- name: Code Checkout
uses: actions/checkout@v1
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:

View File

@ -7,23 +7,39 @@ on:
# Run nightly on weekdays at 05:00 UTC or midnight-ish in US time zones
- cron: '0 5 * * 1-5'
env:
runs-on: ['self-hosted', 'ondemand', 't3.nano']
jobs:
slack-vars:
if: github.repository == 'hashicorp/vagrant-builders'
name: Populate vars
runs-on: env.runs-on
uses: ./.github/workflows/slack-vars.yml
packet-vars:
if: github.repository == 'hashicorp/vagrant-builders'
name: Populate vars
runs-on: env.runs-on
uses: ./.github/workflows/packet-vars.yml
setup-packet:
if: github.repository == 'hashicorp/vagrant-acceptance'
runs-on: self-hosted
runs-on: env.runs-on
name: Build Packet Instance
steps:
- name: Code Checkout
uses: actions/checkout@v1
uses: actions/checkout@v3
- name: Create packet instance
run: ./.ci/spec/create-packet.sh
working-directory: ${{github.workspace}}
env:
VAGRANT_CI_LOADER_BUCKET: ${{ secrets.VAGRANT_CI_LOADER_BUCKET }}
PACKET_EXEC_TOKEN: ${{ needs.packet-vars.outputs.PACKET_EXEC_TOKEN }}
PACKET_EXEC_PROJECT_ID: ${{ needs.packet-vars.outputs.PACKET_EXEC_PROJECT_ID }}
PACKET_SSH_KEY_CONTENT: ${{ needs.packet-vars.outputs.PACKET_SSH_KEY_CONTENT }}
PKT_SECRET_PHRASE: ${{ needs.packaging-vars.outputs.ASSETS_PASSWORD }}
SLACK_WEBHOOK: ${{ needs.slack-vars.outputs.SLACK_WEBHOOK }}
setup-hosts:
if: github.repository == 'hashicorp/vagrant-acceptance'
runs-on: self-hosted
runs-on: env.runs-on
name: Vagrant-Spec Start Hosts
needs: setup-packet
strategy:
@ -33,22 +49,26 @@ jobs:
providers: ['virtualbox', 'docker']
steps:
- name: Code Checkout
uses: actions/checkout@v1
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Create hosts for tests (provider ${{ matrix.providers }})
run: ./.ci/spec/create-hosts.sh
working-directory: ${{github.workspace}}
env:
PACKET_EXEC_TOKEN: ${{ needs.packet-vars.outputs.PACKET_EXEC_TOKEN }}
PACKET_EXEC_PROJECT_ID: ${{ needs.packet-vars.outputs.PACKET_EXEC_PROJECT_ID }}
PACKET_SSH_KEY_CONTENT: ${{ needs.packet-vars.outputs.PACKET_SSH_KEY_CONTENT }}
PKT_SECRET_PHRASE: ${{ needs.packaging-vars.outputs.ASSETS_PASSWORD }}
SLACK_WEBHOOK: ${{ needs.slack-vars.outputs.SLACK_WEBHOOK }}
VAGRANT_HOST_BOXES: ${{matrix.host_os}}
VAGRANT_GUEST_BOXES: ${{matrix.guest_os}}
VAGRANT_PRERELEASE_VERSION: ${{ github.event.client_payload.prerelease_version }}
VAGRANT_SPEC_PROVIDERS: ${{matrix.providers}}
VAGRANT_CI_LOADER_BUCKET: ${{ secrets.VAGRANT_CI_LOADER_BUCKET }}
spec-tests:
if: github.repository == 'hashicorp/vagrant-acceptance'
runs-on: self-hosted
runs-on: env.runs-on
name: Vagrant-Spec Tests
needs: setup-hosts
strategy:
@ -62,31 +82,34 @@ jobs:
run: ./.ci/spec/run-test.sh
working-directory: ${{github.workspace}}
env:
PACKET_EXEC_TOKEN: ${{ needs.packet-vars.outputs.PACKET_EXEC_TOKEN }}
PACKET_EXEC_PROJECT_ID: ${{ needs.packet-vars.outputs.PACKET_EXEC_PROJECT_ID }}
PACKET_SSH_KEY_CONTENT: ${{ needs.packet-vars.outputs.PACKET_SSH_KEY_CONTENT }}
PKT_SECRET_PHRASE: ${{ needs.packaging-vars.outputs.ASSETS_PASSWORD }}
SLACK_WEBHOOK: ${{ needs.slack-vars.outputs.SLACK_WEBHOOK }}
VAGRANT_HOST_BOXES: ${{matrix.host_os}}
VAGRANT_GUEST_BOXES: ${{matrix.guest_os}}
VAGRANT_SPEC_PROVIDERS: ${{matrix.providers}}
VAGRANT_DOCKER_IMAGES: ${{matrix.docker_images}}
VAGRANT_CI_LOADER_BUCKET: ${{ secrets.VAGRANT_CI_LOADER_BUCKET }}
HASHIBOT_USERNAME: ${{ secrets.HASHIBOT_USERNAME }}
HASHIBOT_TOKEN: ${{ secrets.HASHIBOT_TOKEN }}
- name: Pull log from guest
if: always()
run: ./.ci/spec/pull-log.sh
env:
PACKET_EXEC_TOKEN: ${{ needs.packet-vars.outputs.PACKET_EXEC_TOKEN }}
PACKET_EXEC_PROJECT_ID: ${{ needs.packet-vars.outputs.PACKET_EXEC_PROJECT_ID }}
PACKET_SSH_KEY_CONTENT: ${{ needs.packet-vars.outputs.PACKET_SSH_KEY_CONTENT }}
PKT_SECRET_PHRASE: ${{ needs.packaging-vars.outputs.ASSETS_PASSWORD }}
SLACK_WEBHOOK: ${{ needs.slack-vars.outputs.SLACK_WEBHOOK }}
VAGRANT_HOST_BOXES: ${{matrix.host_os}}
VAGRANT_GUEST_BOXES: ${{matrix.guest_os}}
VAGRANT_SPEC_PROVIDERS: ${{matrix.providers}}
VAGRANT_DOCKER_IMAGES: ${{matrix.docker_images}}
VAGRANT_CI_LOADER_BUCKET: ${{ secrets.VAGRANT_CI_LOADER_BUCKET }}
HASHIBOT_USERNAME: ${{ secrets.HASHIBOT_USERNAME }}
HASHIBOT_TOKEN: ${{ secrets.HASHIBOT_TOKEN }}
- name: Upload log
if: always()
uses: actions/upload-artifact@v3
with:
name: vagrant-spec-${{matrix.providers}}.log
path: ${{ github.workspace }}/vagrant-spec.log
notify-on-success:
if: github.repository == 'hashicorp/vagrant-acceptance' && success()
runs-on: self-hosted
@ -95,6 +118,8 @@ jobs:
steps:
- name: Notify on Success
run: ./.ci/spec/notify-success.sh
env:
SLACK_WEBHOOK: ${{ needs.slack-vars.outputs.SLACK_WEBHOOK }}
cleanup:
if: github.repository == 'hashicorp/vagrant-acceptance'
@ -104,6 +129,11 @@ jobs:
steps:
- name: Clean Packet
run: ./.ci/spec/clean-packet.sh
env:
PACKET_EXEC_TOKEN: ${{ needs.packet-vars.outputs.PACKET_EXEC_TOKEN }}
PACKET_EXEC_PROJECT_ID: ${{ needs.packet-vars.outputs.PACKET_EXEC_PROJECT_ID }}
PACKET_SSH_KEY_CONTENT: ${{ needs.packet-vars.outputs.PACKET_SSH_KEY_CONTENT }}
PKT_SECRET_PHRASE: ${{ needs.packaging-vars.outputs.ASSETS_PASSWORD }}
SLACK_WEBHOOK: ${{ needs.slack-vars.outputs.SLACK_WEBHOOK }}
- name: Clean Workspace
run: rm -rf ${{ github.workspace }}

View File

@ -27,7 +27,7 @@ on:
jobs:
unit-tests-ruby:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
@ -35,10 +35,11 @@ jobs:
name: Vagrant unit tests on Ruby ${{ matrix.ruby }}
steps:
- name: Code Checkout
uses: actions/checkout@v1
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{matrix.ruby}}
bundler-cache: true
- name: Run Tests
run: .ci/test.sh
run: bundle exec rake test:unit