Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
191 changes: 191 additions & 0 deletions .github/workflows/dd-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
name: Build and Push etcd releases

on:
push:
# Sequence of patterns matched against refs/heads
tags:
# Push events on datadog tags
- "*-dd*"
permissions: write-all
jobs:
build-amd64:
strategy:
matrix:
platform: ["linux/amd64"]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
fetch-depth: 0
- name: Set environment variables
id: set_env
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "TARGET_OS=$(echo ${{ matrix.platform }} | cut -d'/' -f1)" >> $GITHUB_ENV
echo "TARGET_ARCH=$(echo ${{ matrix.platform }} | cut -d'/' -f2)" >> $GITHUB_ENV
env:
GITHUB_REF: ${{ github.ref }}
- name: Build etcd
run: |
REPOSITORY=https://github.com/${{ env.GITHUB_REPOSITORY }}.git \
CGO_ENABLED=1 \
GOEXPERIMENT=boringcrypto \
GO_BUILD_FLAGS="-tags=fips" \
TARGET_OS=${TARGET_OS} \
TARGET_ARCH=${TARGET_ARCH} \
./scripts/build-binary-single-target ${{ env.RELEASE_VERSION }}
env:
GITHUB_REPOSITORY: ${{ github.repository }}
- name: Calculate checksums
id: calculate_checksums
shell: bash
working-directory: release/
run: ls . | grep -E '\.tar.gz$|\.zip$' | xargs shasum -a 256 > ./SHA256SUMS
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: etcd_output_amd64
path: release/
build-arm64:
strategy:
matrix:
platform: ["linux/arm64"]
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
fetch-depth: 0
- name: Set environment variables
id: set_env
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "TARGET_OS=$(echo ${{ matrix.platform }} | cut -d'/' -f1)" >> $GITHUB_ENV
echo "TARGET_ARCH=$(echo ${{ matrix.platform }} | cut -d'/' -f2)" >> $GITHUB_ENV
env:
GITHUB_REF: ${{ github.ref }}
- name: Build etcd
run: |
REPOSITORY=https://github.com/${{ env.GITHUB_REPOSITORY }}.git \
CGO_ENABLED=1 \
GOEXPERIMENT=boringcrypto \
GO_BUILD_FLAGS="-tags=fips" \
TARGET_OS=${TARGET_OS} \
TARGET_ARCH=${TARGET_ARCH} \
./scripts/build-binary-single-target ${{ env.RELEASE_VERSION }}
env:
GITHUB_REPOSITORY: ${{ github.repository }}
- name: Calculate checksums
id: calculate_checksums
shell: bash
working-directory: release/
run: ls . | grep -E '\.tar.gz$|\.zip$' | xargs shasum -a 256 > ./SHA256SUMS
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: etcd_output_arm64
path: release/
release:
permissions:
contents: write
runs-on: ubuntu-latest
needs: [build-amd64, build-arm64]
outputs:
upload_url: ${{ steps.create_release_branch.outputs.upload_url }}${{ steps.create_release_tags.outputs.upload_url }}
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
env:
GITHUB_REF: ${{ github.ref }}
if: startsWith(github.ref, 'refs/heads/')
- name: Create Release for Branch
id: create_release_branch
uses: softprops/action-gh-release@5be0e66d93ac7ed76da52eca8bb058f665c3a5fe # v2.4.2
if: startsWith(github.ref, 'refs/heads/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: branch@${{ steps.extract_branch.outputs.branch }}
tag_name: branch@${{ steps.extract_branch.outputs.branch }}
draft: false
prerelease: false
- name: Extract tags name
shell: bash
run: echo "##[set-output name=tags;]$(echo ${GITHUB_REF#refs/tags/})"
id: extract_tags
env:
GITHUB_REF: ${{ github.ref }}
if: startsWith(github.ref, 'refs/tags/')
- name: Create Release for Tags
id: create_release_tags
uses: softprops/action-gh-release@5be0e66d93ac7ed76da52eca8bb058f665c3a5fe # v2.4.2
if: ${{ startsWith(github.ref, 'refs/tags/') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ steps.extract_tags.outputs.tags }}
tag_name: ${{ steps.extract_tags.outputs.tags }}
release_name: ${{ steps.extract_tags.outputs.tags }}
draft: false
prerelease: false
releaseassets:
runs-on: ubuntu-latest
needs: release
strategy:
matrix:
platform: ["linux-arm64","linux-amd64"]
extension: ["tar.gz"]
steps:
- name: Set artifact name
id: set_artifact
run: |
if [[ "${{ matrix.platform }}" == *"arm64"* ]]; then
echo "ARTIFACT_NAME=etcd_output_arm64" >> $GITHUB_ENV
else
echo "ARTIFACT_NAME=etcd_output_amd64" >> $GITHUB_ENV
fi
- name: Download artifacts
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
name: ${{ env.ARTIFACT_NAME }}
path: _output/release-tars
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set release version environment variable
run: echo RELEASE_VERSION=${GITHUB_REF#refs/tags/} >> $GITHUB_ENV
env:
GITHUB_REF: ${{ github.ref }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./_output/release-tars/etcd-${{ env.RELEASE_VERSION }}-${{ matrix.platform }}.${{ matrix.extension }}
asset_name: etcd-${{ env.RELEASE_VERSION }}-${{ matrix.platform }}.${{ matrix.extension }}
asset_content_type: application/tar+gzip
addchecksum:
runs-on: ubuntu-latest
needs: release
steps:
- name: Create output directory
run: mkdir -p _output/checksums
- name: Download all artifacts
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
path: _output/artifacts
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Combine checksums
run: |
find _output/artifacts -name "SHA256SUMS" -exec cat {} \; > _output/checksums/SHA256SUMS
- name: Upload checksums
id: upload-checksums
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./_output/checksums/SHA256SUMS
asset_name: SHA256SUMS
asset_content_type: text/plain
38 changes: 38 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: E2E
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
target:
- linux-amd64-e2e
# - linux-386-e2e
steps:
- uses: actions/checkout@v2
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@v2
with:
go-version: ${{ steps.goversion.outputs.goversion }}
- run: date
- env:
TARGET: ${{ matrix.target }}
run: |
set -euo pipefail

echo "${TARGET}"
case "${TARGET}" in
linux-amd64-e2e)
make install-gofail
CPU='4' EXPECT_DEBUG='true' COVER='false' RACE='true' FAILPOINTS='true' make test-e2e-release
;;
linux-386-e2e)
GOARCH=386 CPU='4' EXPECT_DEBUG='true' COVER='false' RACE='true' make test-e2e
;;
*)
echo "Failed to find target"
exit 1
;;
esac
33 changes: 33 additions & 0 deletions .github/workflows/functional.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: functional-tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
target:
- linux-amd64-functional
steps:
- uses: actions/checkout@v2
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@v2
with:
go-version: ${{ steps.goversion.outputs.goversion }}
- run: date
- env:
TARGET: ${{ matrix.target }}
run: |
set -euo pipefail

echo "${TARGET}"
case "${TARGET}" in
linux-amd64-functional)
GO_BUILD_FLAGS='-v -mod=readonly' ./build && GOARCH=amd64 PASSES='functional' ./test
;;
*)
echo "Failed to find target"
exit 1
;;
esac
33 changes: 33 additions & 0 deletions .github/workflows/grpcproxy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: grpcProxy-tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
target:
- linux-amd64-grpcproxy
steps:
- uses: actions/checkout@v2
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@v2
with:
go-version: ${{ steps.goversion.outputs.goversion }}
- run: date
- env:
TARGET: ${{ matrix.target }}
run: |
set -euo pipefail

echo "${TARGET}"
case "${TARGET}" in
linux-amd64-grpcproxy)
PASSES='build grpcproxy' CPU='4' COVER='false' RACE='true' ./test.sh
;;
*)
echo "Failed to find target"
exit 1
;;
esac
32 changes: 32 additions & 0 deletions .github/workflows/static-analysis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Static Analysis
on: [push, pull_request]
permissions: read-all
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: ${{ steps.goversion.outputs.goversion }}
- run: |
set -euo pipefail

make verify
- run: |
set -euo pipefail

make fix

DIFF=$(git status --porcelain)

if [ -n "$DIFF" ]; then
echo "These files were modified:"
echo
echo "$DIFF"
echo
exit 1
fi
Loading
Loading