From d5d925a78ffb90bea269658b5dcc8c4a5788d9b6 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Wed, 26 Oct 2022 16:03:22 -0700 Subject: [PATCH 1/3] Print first element when generating path --- .ci/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/build.sh b/.ci/build.sh index f5f038957..d440fb22d 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -14,7 +14,7 @@ wrap gem build *.gemspec \ # Get the path of our new gem g=(vagrant*.gem) -gem=$(printf "%s" "${g}") +gem=$(printf "%s" "${g[0]}") # Store the gem asset wrap aws s3 cp "${gem}" "${ASSETS_PRIVATE_BUCKET}/${repository}/vagrant-main.gem" \ From 479a0c60d09716e3fb9190bc371b9c4ff04ca4bc Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Wed, 26 Oct 2022 16:37:08 -0700 Subject: [PATCH 2/3] Clean up workflows and scripts --- .ci/build.sh | 4 +- .ci/release.sh | 20 ++++------ .github/workflows/build.yml | 14 +------ .github/workflows/code.yml | 10 +---- .github/workflows/go-spectest.yml | 9 ++--- .github/workflows/go-testing.yml | 9 ++--- .github/workflows/release.yml | 5 ++- .github/workflows/spectesting.yml | 62 +++++++++++++++++++++++-------- .github/workflows/testing.yml | 7 ++-- 9 files changed, 70 insertions(+), 70 deletions(-) diff --git a/.ci/build.sh b/.ci/build.sh index d440fb22d..15dfa9159 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -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 diff --git a/.ci/release.sh b/.ci/release.sh index a1e524c71..531eb09b8 100755 --- a/.ci/release.sh +++ b/.ci/release.sh @@ -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 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9a6e3bb2f..4f8e7c730 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 }} diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index 63ad1e8f4..135c3711e 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -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 }} diff --git a/.github/workflows/go-spectest.yml b/.github/workflows/go-spectest.yml index 27a9c2f2e..14e2e89ab 100644 --- a/.github/workflows/go-spectest.yml +++ b/.github/workflows/go-spectest.yml @@ -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" diff --git a/.github/workflows/go-testing.yml b/.github/workflows/go-testing.yml index 29cee6fe6..f1f1ea160 100644 --- a/.github/workflows/go-testing.yml +++ b/.github/workflows/go-testing.yml @@ -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" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f800f2f08..1d8bfb884 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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: diff --git a/.github/workflows/spectesting.yml b/.github/workflows/spectesting.yml index ad72d64ca..666c3d583 100644 --- a/.github/workflows/spectesting.yml +++ b/.github/workflows/spectesting.yml @@ -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 }} - diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 3f1bcbde3..07579046a 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -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 From 82226258218f5fed8bc556cdf9b4ad60e3ebfcb8 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Wed, 26 Oct 2022 16:37:39 -0700 Subject: [PATCH 3/3] Don't include comment when locking issues/PRs --- .github/CONTRIBUTING.md | 1 + .github/workflows/lock.yml | 8 -------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 27a98dde8..7de8be1ca 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -21,6 +21,7 @@ To ensure that the Vagrant community remains an open and safe space for everyone 3. Unless it is critical, the issue is left for a period of time, giving outside contributors a chance to address the issue. Later, the issue may be assigned to a Vagrant collaborator and planned for a specific release [milestone](https://github.com/hashicorp/vagrant/milestones) 4. The issue is addressed in a pull request or commit. The issue will be referenced in the commit message so that the code that fixes it is clearly linked. 5. The issue is closed. Sometimes, valid issues will be closed to keep the issue tracker clean. The issue is still indexed and available for future viewers, or can be re-opened if necessary. +6. The issue is locked. After about 30 days the issue will be locked. This is done to keep issue activity in open issues and encourge users to open a new issue if an old issue is being encountered again. ## Pull Requests diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml index 412aa5a4a..ea30ef817 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -11,13 +11,5 @@ jobs: - uses: dessant/lock-threads@v2 with: github-token: ${{ github.token }} - issue-lock-comment: > - I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues. - - If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. issue-lock-inactive-days: '30' - pr-lock-comment: > - I'm going to lock this pull request because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues. - - If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. pr-lock-inactive-days: '30'