-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert hashicorp/vault-ruby to GitHub Actions (#287)
* Add workflow hashicorp/vault-ruby/run-tests * SHA-pin all 3rd-party actions * Restrict workflow permissions * Add actionslint * Add dependabot * Add CODEOWNERS * Replace deprecated references * add new config Signed-off-by: Daniel Huckins <[email protected]> * remove app id Signed-off-by: Daniel Huckins <[email protected]> * Fixnum is deprecated Signed-off-by: Daniel Huckins <[email protected]> * add webrick Signed-off-by: Daniel Huckins <[email protected]> * update codeowners Signed-off-by: Daniel Huckins <[email protected]> * remove circleci Signed-off-by: Daniel Huckins <[email protected]> --------- Signed-off-by: Daniel Huckins <[email protected]> Co-authored-by: Daniel Huckins <[email protected]>
- Loading branch information
1 parent
b34b02a
commit 3764e56
Showing
9 changed files
with
110 additions
and
173 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,7 @@ | ||
version: 2 | ||
|
||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
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,14 @@ | ||
# If the repository is public, be sure to change to GitHub hosted runners | ||
name: Lint GitHub Actions Workflows | ||
on: | ||
push: | ||
pull_request: | ||
permissions: | ||
contents: read | ||
jobs: | ||
actionlint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | ||
- name: "Check workflow files" | ||
uses: docker://docker.mirror.hashicorp.services/rhysd/actionlint:latest |
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 |
---|---|---|
|
@@ -5,68 +5,62 @@ on: | |
types: [opened, closed, reopened] | ||
issue_comment: # Also triggers when commenting on a PR from the conversation view | ||
types: [created] | ||
|
||
name: Jira Sync | ||
|
||
jobs: | ||
sync: | ||
runs-on: ubuntu-latest | ||
name: Jira sync | ||
steps: | ||
- name: Login | ||
uses: atlassian/[email protected] | ||
env: | ||
JIRA_BASE_URL: ${{ secrets.JIRA_SYNC_BASE_URL }} | ||
JIRA_USER_EMAIL: ${{ secrets.JIRA_SYNC_USER_EMAIL }} | ||
JIRA_API_TOKEN: ${{ secrets.JIRA_SYNC_API_TOKEN }} | ||
|
||
- name: Preprocess | ||
if: github.event.action == 'opened' || github.event.action == 'created' | ||
id: preprocess | ||
run: | | ||
if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then | ||
echo "::set-output name=type::PR" | ||
else | ||
echo "::set-output name=type::ISS" | ||
fi | ||
- name: Create ticket | ||
if: github.event.action == 'opened' | ||
uses: tomhjp/[email protected] | ||
with: | ||
project: VAULT | ||
issuetype: "GH Issue" | ||
summary: "${{ github.event.repository.name }} [${{ steps.preprocess.outputs.type }} #${{ github.event.issue.number || github.event.pull_request.number }}]: ${{ github.event.issue.title || github.event.pull_request.title }}" | ||
description: "${{ github.event.issue.body || github.event.pull_request.body }}\n\n_Created from GitHub Action for ${{ github.event.issue.html_url || github.event.pull_request.html_url }} from ${{ github.actor }}_" | ||
# customfield_10089 is Issue Link custom field | ||
# customfield_10091 is team custom field | ||
extraFields: '{"fixVersions": [{"name": "TBD"}], "customfield_10091": ["ecosystem", "applications"], "customfield_10089": "${{ github.event.issue.html_url || github.event.pull_request.html_url }}"}' | ||
|
||
- name: Search | ||
if: github.event.action != 'opened' | ||
id: search | ||
uses: tomhjp/[email protected] | ||
with: | ||
# cf[10089] is Issue Link custom field | ||
jql: 'project = "VAULT" and cf[10089]="${{ github.event.issue.html_url || github.event.pull_request.html_url }}"' | ||
|
||
- name: Sync comment | ||
if: github.event.action == 'created' && steps.search.outputs.issue | ||
uses: tomhjp/[email protected] | ||
with: | ||
issue: ${{ steps.search.outputs.issue }} | ||
comment: "${{ github.actor }} ${{ github.event.review.state || 'commented' }}:\n\n${{ github.event.comment.body || github.event.review.body }}\n\n${{ github.event.comment.html_url || github.event.review.html_url }}" | ||
|
||
- name: Close ticket | ||
if: (github.event.action == 'closed' || github.event.action == 'deleted') && steps.search.outputs.issue | ||
uses: atlassian/[email protected] | ||
with: | ||
issue: ${{ steps.search.outputs.issue }} | ||
transition: Closed | ||
|
||
- name: Reopen ticket | ||
if: github.event.action == 'reopened' && steps.search.outputs.issue | ||
uses: atlassian/[email protected] | ||
with: | ||
issue: ${{ steps.search.outputs.issue }} | ||
transition: "Pending Triage" | ||
- name: Login | ||
uses: atlassian/gajira-login@ca13f8850ea309cf44a6e4e0c49d9aa48ac3ca4c # v3 | ||
env: | ||
JIRA_BASE_URL: ${{ secrets.JIRA_SYNC_BASE_URL }} | ||
JIRA_USER_EMAIL: ${{ secrets.JIRA_SYNC_USER_EMAIL }} | ||
JIRA_API_TOKEN: ${{ secrets.JIRA_SYNC_API_TOKEN }} | ||
- name: Preprocess | ||
if: github.event.action == 'opened' || github.event.action == 'created' | ||
id: preprocess | ||
run: | | ||
if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then | ||
echo "type=PR" >> "$GITHUB_OUTPUT" | ||
else | ||
echo "type=ISS" >> "$GITHUB_OUTPUT" | ||
fi | ||
- name: Create ticket | ||
if: github.event.action == 'opened' | ||
uses: tomhjp/gh-action-jira-create@3ed1789cad3521292e591a7cfa703215ec1348bf # v0.2.1 | ||
with: | ||
project: VAULT | ||
issuetype: "GH Issue" | ||
summary: "${{ github.event.repository.name }} [${{ steps.preprocess.outputs.type }} #${{ github.event.issue.number || github.event.pull_request.number }}]: ${{ github.event.issue.title || github.event.pull_request.title }}" | ||
description: "${{ github.event.issue.body || github.event.pull_request.body }}\n\n_Created from GitHub Action for ${{ github.event.issue.html_url || github.event.pull_request.html_url }} from ${{ github.actor }}_" | ||
# customfield_10089 is Issue Link custom field | ||
# customfield_10091 is team custom field | ||
extraFields: '{"fixVersions": [{"name": "TBD"}], "customfield_10091": ["ecosystem", "applications"], "customfield_10089": "${{ github.event.issue.html_url || github.event.pull_request.html_url }}"}' | ||
- name: Search | ||
if: github.event.action != 'opened' | ||
id: search | ||
uses: tomhjp/gh-action-jira-search@04700b457f317c3e341ce90da5a3ff4ce058f2fa # v0.2.2 | ||
with: | ||
# cf[10089] is Issue Link custom field | ||
jql: 'project = "VAULT" and cf[10089]="${{ github.event.issue.html_url || github.event.pull_request.html_url }}"' | ||
- name: Sync comment | ||
if: github.event.action == 'created' && steps.search.outputs.issue | ||
uses: tomhjp/gh-action-jira-comment@6eb6b9ead70221916b6badd118c24535ed220bd9 # v0.2.0 | ||
with: | ||
issue: ${{ steps.search.outputs.issue }} | ||
comment: "${{ github.actor }} ${{ github.event.review.state || 'commented' }}:\n\n${{ github.event.comment.body || github.event.review.body }}\n\n${{ github.event.comment.html_url || github.event.review.html_url }}" | ||
- name: Close ticket | ||
if: (github.event.action == 'closed' || github.event.action == 'deleted') && steps.search.outputs.issue | ||
uses: atlassian/gajira-transition@4749176faf14633954d72af7a44d7f2af01cc92b # v3 | ||
with: | ||
issue: ${{ steps.search.outputs.issue }} | ||
transition: Closed | ||
- name: Reopen ticket | ||
if: github.event.action == 'reopened' && steps.search.outputs.issue | ||
uses: atlassian/gajira-transition@4749176faf14633954d72af7a44d7f2af01cc92b # v3 | ||
with: | ||
issue: ${{ steps.search.outputs.issue }} | ||
transition: "Pending Triage" | ||
permissions: | ||
contents: read |
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,33 @@ | ||
name: hashicorp/vault-ruby/run-tests | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
jobs: | ||
test: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# https://endoflife.date/ruby | ||
ruby: ["2.7", "3.0", "3.1", "3.2"] | ||
vault: ["1.11.9", "1.12.5", "1.13.1"] | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby }} | ||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | ||
- name: "Install vault cli" | ||
run: | | ||
curl -sLo vault.zip "https://releases.hashicorp.com/vault/${{ matrix.vault }}/vault_${{ matrix.vault }}_linux_amd64.zip" | ||
unzip vault.zip | ||
mkdir -p "$HOME/bin" | ||
mv vault "$HOME/bin" | ||
echo "$HOME/bin" >> "$GITHUB_PATH" | ||
- run: bundle exec rake | ||
|
||
permissions: | ||
contents: read |
Validating CODEOWNERS rules …
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 @@ | ||
* @hashicorp/vault-devex |
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
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