Skip to content

Commit

Permalink
backport of commit a07f28a
Browse files Browse the repository at this point in the history
  • Loading branch information
AnPucel committed Apr 20, 2022
1 parent 6b3c594 commit 0d36b55
Show file tree
Hide file tree
Showing 756 changed files with 43,902 additions and 29,881 deletions.
76 changes: 51 additions & 25 deletions .circleci/config.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 0 additions & 14 deletions .circleci/config/commands/setup-semgrep.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .circleci/config/jobs/algolia-index.yml
@@ -0,0 +1,15 @@
docker:
- image: node:14
steps:
- checkout
- run:
name: Push content to Algolia Index
command: |
if [ "$CIRCLE_REPOSITORY_URL" != "git@github.com:hashicorp/vault.git" ]; then
echo "Not Vault OSS Repo, not indexing Algolia"
exit 0
fi
cd website/
npm install -g npm@latest
npm install
node scripts/index_search_content.js
14 changes: 0 additions & 14 deletions .circleci/config/jobs/semgrep.yml

This file was deleted.

22 changes: 22 additions & 0 deletions .circleci/config/jobs/website-docker-image.yml
@@ -0,0 +1,22 @@
docker:
- image: circleci/buildpack-deps
shell: /usr/bin/env bash -euo pipefail -c
steps:
- checkout
- setup_remote_docker
- run:
name: Build Docker Image if Necessary
command: |
IMAGE_TAG="$(git rev-list -n1 HEAD -- website/Dockerfile website/package-lock.json)"
echo "Using $IMAGE_TAG"
if [ "$CIRCLE_REPOSITORY_URL" != "git@github.com:hashicorp/vault.git" ]; then
echo "Not Vault OSS Repo, not building website docker image"
elif curl https://hub.docker.com/v2/repositories/hashicorp/vault-website/tags/$IMAGE_TAG -fsL > /dev/null; then
echo "Dependencies have not changed, not building a new website docker image."
else
cd website/
docker build -t hashicorp/vault-website:$IMAGE_TAG .
docker tag hashicorp/vault-website:$IMAGE_TAG hashicorp/vault-website:latest
docker login -u $WEBSITE_DOCKER_USER -p $WEBSITE_DOCKER_PASS
docker push hashicorp/vault-website
fi
15 changes: 12 additions & 3 deletions .circleci/config/workflows/ci.yml
Expand Up @@ -38,6 +38,15 @@ jobs:
- test-go-race-remote-docker:
requires:
- pre-flight-checks
- semgrep:
requires:
- pre-flight-checks
- website-docker-image:
context: vault-docs
filters:
branches:
only:
- main
- algolia-index:
context: vault-docs
filters:
branches:
only:
- stable-website
46 changes: 46 additions & 0 deletions .github/workflows/backport-docs.yml
@@ -0,0 +1,46 @@
---
name: Backport Assistant Runner For Docs (OSS only)

on:
pull_request_target:
types:
- closed
- labeled

jobs:
backport-for-docs:
if: github.event.pull_request.merged
runs-on: ubuntu-latest
container: hashicorpdev/backport-assistant:0.2.3
steps:
- name: Backport changes to stable-website
run: |
backport-assistant backport -automerge -merge-method=squash
env:
BACKPORT_LABEL_REGEXP: "backport/(?P<target>website)"
BACKPORT_TARGET_TEMPLATE: "stable-{{.target}}"
GITHUB_TOKEN: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
- name: Backport changes labeled website to latest release branch
if: always()
run: |
resp=$(curl -f -s "https://api.github.com/repos/$GITHUB_REPOSITORY/releases?per_page=100")
ret="$?"
if [[ "$ret" -ne 0 ]]; then
echo "The GitHub API returned $ret"
exit $ret
fi
# find the latest non-rc release
latest_version=$(echo "$resp" | tr '\r\n' ' ' | jq -r '.[] | select(.name|test("^v\\d+\\.\\d+\\.\\d+$")) | .name' | sort -rV | head -n1)
echo "Latest non-rc version: $latest_version"
# strip leading "v" &
target="${latest_version#v}"
# replace patch version with "x"
target="${target%.*}.x"
export BACKPORT_TARGET_TEMPLATE="release/$target"
backport-assistant backport
env:
BACKPORT_LABEL_REGEXP: "backport/(?P<target>website)"
GITHUB_TOKEN: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
30 changes: 9 additions & 21 deletions .github/workflows/build.yml
Expand Up @@ -4,8 +4,8 @@ on:
push:
# Sequence of patterns matched against refs/heads
branches:
# Push events on main branch
- main
# Push events on release/1.10.x branch
- release/1.10.x

env:
PKG_NAME: "vault"
Expand All @@ -27,18 +27,6 @@ jobs:
echo "::set-output name=product-version::$(make version)"
echo "::set-output name=product-base-version::${BASE_VERSION}"
get-build-date:
runs-on: ubuntu-latest
outputs:
build-date: ${{ steps.get-build-date.outputs.build-date }}
steps:
- uses: actions/checkout@v2
- name: get build date
id: get-build-date
run: |
make build-date
echo "::set-output name=build-date::$(make build-date)"
generate-metadata-file:
needs: get-product-version
runs-on: ubuntu-latest
Expand All @@ -49,7 +37,7 @@ jobs:
uses: actions/checkout@v2
- name: Generate metadata file
id: generate-metadata-file
uses: hashicorp/actions-generate-metadata@main
uses: hashicorp/actions-generate-metadata@v1
with:
version: ${{ needs.get-product-version.outputs.product-version }}
product: ${{ env.PKG_NAME }}
Expand All @@ -60,7 +48,7 @@ jobs:
path: ${{ steps.generate-metadata-file.outputs.filepath }}

build-other:
needs: [ get-product-version, get-build-date ]
needs: get-product-version
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -104,15 +92,15 @@ jobs:
CGO_ENABLED: 0
run: |
mkdir dist out
GO_TAGS="${{ env.GO_TAGS }}" VAULT_VERSION=${{ needs.get-product-version.outputs.product-base-version }} VAULT_REVISION="$(git rev-parse HEAD)" VAULT_BUILD_DATE="${{ needs.get-build-date.outputs.build-date }}" make build
GO_TAGS="${{ env.GO_TAGS }}" VAULT_VERSION=${{ needs.get-product-version.outputs.product-base-version }} VAULT_REVISION="$(git rev-parse HEAD)" make build
zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/
- uses: actions/upload-artifact@v2
with:
name: ${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
path: out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip

build-linux:
needs: [ get-product-version, get-build-date ]
needs: get-product-version
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -150,7 +138,7 @@ jobs:
CGO_ENABLED: 0
run: |
mkdir dist out
GO_TAGS="${{ env.GO_TAGS }}" VAULT_VERSION=${{ needs.get-product-version.outputs.product-base-version }} VAULT_REVISION="$(git rev-parse HEAD)" VAULT_BUILD_DATE="${{ needs.get-build-date.outputs.build-date }}" make build
GO_TAGS="${{ env.GO_TAGS }}" VAULT_VERSION=${{ needs.get-product-version.outputs.product-base-version }} VAULT_REVISION="$(git rev-parse HEAD)" make build
zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/
- uses: actions/upload-artifact@v2
with:
Expand Down Expand Up @@ -189,7 +177,7 @@ jobs:
path: out/${{ env.DEB_PACKAGE }}

build-darwin:
needs: [ get-product-version, get-build-date ]
needs: get-product-version
runs-on: macos-latest
strategy:
matrix:
Expand Down Expand Up @@ -226,7 +214,7 @@ jobs:
CGO_ENABLED: 0
run: |
mkdir dist out
GO_TAGS="${{ env.GO_TAGS }}" VAULT_VERSION=${{ needs.get-product-version.outputs.product-base-version }} VAULT_REVISION="$(git rev-parse HEAD)" VAULT_BUILD_DATE="${{ needs.get-build-date.outputs.build-date }}" make build
GO_TAGS="${{ env.GO_TAGS }}" VAULT_VERSION=${{ needs.get-product-version.outputs.product-base-version }} VAULT_REVISION="$(git rev-parse HEAD)" make build
zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/
- uses: actions/upload-artifact@v2
with:
Expand Down

0 comments on commit 0d36b55

Please sign in to comment.