Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into issue/10076
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Pakulski <paker8848@gmail.com>
  • Loading branch information
cpakulski committed Jul 12, 2024
2 parents 00127c8 + bea314b commit 1e9c894
Show file tree
Hide file tree
Showing 211 changed files with 4,111 additions and 2,054 deletions.
147 changes: 15 additions & 132 deletions .azure-pipelines/env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,152 +62,35 @@ jobs:
- checkout: self
fetchDepth: 0
fetchTags: true
- bash: |
# TODO(phlax): move this to a script to ensure proper linting etc
set -e
# Only exclude checks in pull requests.
if [[ $(Build.Reason) != "PullRequest" ]]; then
echo "##vso[task.setvariable variable=mobileOnly;isoutput=true]false"
echo "##vso[task.setvariable variable=docsOnly;isoutput=true]false"
echo "##vso[task.setvariable variable=examplesOnly;isoutput=true]false"
echo "##vso[task.setvariable variable=requirements;isoutput=true]true"
exit 0
fi
CHANGE_TARGET="origin/$(System.PullRequest.TargetBranch)"
echo "Comparing changes ${CHANGE_TARGET}...HEAD"
CHANGED_PATHS="$(git diff --name-only ${CHANGE_TARGET}...HEAD | cut -d/ -f1 | sort -u | jq -sR 'rtrimstr("\n") | split("\n")')"
echo "$CHANGED_PATHS" | jq '.'
CHANGED_PATH_COUNT=$(echo $CHANGED_PATHS | jq '. | length')
CHANGED_MOBILE_ONLY=false
CHANGED_DOCS_ONLY=false
CHANGED_EXAMPLES_ONLY=false
CHANGED_MOBILE=$(echo $CHANGED_PATHS | jq '. as $A | "mobile" | IN($A[])')
if [[ $CHANGED_MOBILE == true && $CHANGED_PATH_COUNT -eq 1 ]]; then
CHANGED_MOBILE_ONLY=true
fi
CHANGED_DOCS=$(echo $CHANGED_PATHS | jq '. as $A | "docs" | IN($A[])')
if [[ $CHANGED_DOCS == true && $CHANGED_PATH_COUNT -eq 1 ]]; then
CHANGED_DOCS_ONLY=true
fi
CHANGED_EXAMPLES=$(echo $CHANGED_PATHS | jq '. as $A | "examples" | IN($A[])')
if [[ $CHANGED_EXAMPLES == true && $CHANGED_PATH_COUNT -eq 1 ]]; then
CHANGED_EXAMPLES_ONLY=true
fi
echo "##vso[task.setvariable variable=mobileOnly;isoutput=true]${CHANGED_MOBILE_ONLY}"
echo "##vso[task.setvariable variable=docsOnly;isoutput=true]${CHANGED_DOCS_ONLY}"
echo "##vso[task.setvariable variable=examplesOnly;isoutput=true]${CHANGED_EXAMPLES_ONLY}"
- script: ./.azure-pipelines/env/detect-repo-changes.sh
displayName: "Detect repo changes"
workingDirectory: $(Build.SourcesDirectory)
name: changed
env:
BUILD_REASON: $(Build.Reason)
TARGET_BRANCH: $(System.PullRequest.TargetBranch)

- bash: |
set -e
VERSION_DEV="$(cat VERSION.txt | cut -d- -f2)"
VERSION_PATCH="$(cat VERSION.txt | cut -d- -f1 | rev | cut -d. -f1 | rev)"
echo "##vso[task.setvariable variable=versionPatch;isoutput=true]$VERSION_PATCH"
if [[ $VERSION_DEV == "dev" ]]; then
echo "##vso[task.setvariable variable=isDev;isoutput=true]true"
else
if [[ $(Build.Reason) == "PullRequest" ]]; then
# Check to make sure that it was this PR that changed the version, otherwise fail
# as the branch needs to be reopened first.
# NB: this will not stop a PR that has already passed checks from being landed.
DIFF_TARGET_BRANCH="origin/$(System.PullRequest.TargetBranch)"
DIFF_REF="$(git merge-base HEAD "${DIFF_TARGET_BRANCH}")"
CHANGES="$(git diff "$DIFF_REF" HEAD VERSION.txt)"
if [[ -z "$CHANGES" ]]; then
echo "VERSION.txt is not a development version. Please re-open the branch before making further changes" >&2
exit 1
fi
fi
echo "##vso[task.setvariable variable=isDev;isoutput=true]false"
fi
- script: ./.azure-pipelines/env/set-dev-release-envs.sh
displayName: Set development/release env
workingDirectory: $(Build.SourcesDirectory)
name: state
env:
BUILD_REASON: $(Build.Reason)
TARGET_BRANCH: $(System.PullRequest.TargetBranch)

- bash: |
# TODO(phlax): move this to a script to ensure proper linting etc
set -e
RUN_BUILD=true
RUN_CHECKS=true
RUN_DOCKER=true
RUN_PACKAGING=true
RUN_RELEASE_TESTS=true
if [[ "$(changed.mobileOnly)" == true || "$(changed.docsOnly)" == true ]]; then
RUN_BUILD=false
RUN_DOCKER=false
fi
if [[ "$(changed.mobileOnly)" == true || "$(changed.docsOnly)" == true ]]; then
RUN_CHECKS=false
RUN_PACKAGING=false
fi
if [[ "$(changed.examplesOnly)" == true ]]; then
RUN_CHECKS=false
fi
if [[ "$ISSTABLEBRANCH" == True && -n "$POSTSUBMIT" && "$(state.isDev)" == false ]]; then
RUN_RELEASE_TESTS=false
fi
# Run ~everything in postsubmit
if [[ "$(Build.Reason)" != "PullRequest" ]]; then
echo "##vso[task.setvariable variable=build;isoutput=true]true"
echo "##vso[task.setvariable variable=checks;isoutput=true]true"
echo "##vso[task.setvariable variable=docker;isoutput=true]true"
echo "##vso[task.setvariable variable=packaging;isoutput=true]true"
echo "##vso[task.setvariable variable=releaseTests;isoutput=true]${RUN_RELEASE_TESTS}"
exit 0
fi
echo "##vso[task.setvariable variable=build;isoutput=true]${RUN_BUILD}"
echo "##vso[task.setvariable variable=checks;isoutput=true]${RUN_CHECKS}"
echo "##vso[task.setvariable variable=docker;isoutput=true]${RUN_DOCKER}"
echo "##vso[task.setvariable variable=packaging;isoutput=true]${RUN_PACKAGING}"
echo "##vso[task.setvariable variable=releaseTests;isoutput=true]${RUN_RELEASE_TESTS}"
- script: ./.azure-pipelines/env/decide-what-to-run.sh
displayName: "Decide what to run"
workingDirectory: $(Build.SourcesDirectory)
name: run
env:
BUILD_REASON: $(Build.Reason)

- bash: |
# TODO(phlax): move this to a script to ensure proper linting etc
set -e
PUBLISH_GITHUB_RELEASE=$(run.packaging)
PUBLISH_DOCKERHUB=false
if [[ "$ISSTABLEBRANCH" == True && -n "$POSTSUBMIT" && "$NOSYNC" != true ]]; then
# main
if [[ "$ISMAIN" == True ]]; then
# Update the Dockerhub README
PUBLISH_DOCKERHUB=true
# Not main, and not -dev
elif [[ "$(state.isDev)" == false ]]; then
if [[ "$(state.versionPatch)" -eq 0 ]]; then
# A just-forked branch
PUBLISH_GITHUB_RELEASE=false
fi
fi
fi
# Only run Envoy release CI if explictly set
if ([[ "$PRESUBMIT" != 'true' ]] && [[ "$POSTSUBMIT" != 'true' ]]) || [[ $(Build.Reason) == "Schedule" ]]; then
PUBLISH_GITHUB_RELEASE=false
fi
echo "##vso[task.setvariable variable=githubRelease;isoutput=true]${PUBLISH_GITHUB_RELEASE}"
echo "##vso[task.setvariable variable=dockerhub;isoutput=true]${PUBLISH_DOCKERHUB}"
- script: ./.azure-pipelines/env/decide-what-to-publish.sh
displayName: "Decide what to publish"
workingDirectory: $(Build.SourcesDirectory)
name: publish
env:
BUILD_REASON: $(Build.Reason)

- bash: |
set -e
Expand Down
26 changes: 26 additions & 0 deletions .azure-pipelines/env/decide-what-to-publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash -e

PUBLISH_GITHUB_RELEASE=$RUN_PACKAGING
PUBLISH_DOCKERHUB=false

if [[ "$ISSTABLEBRANCH" == True && -n "$POSTSUBMIT" && "$NOSYNC" != true ]]; then
# main
if [[ "$ISMAIN" == True ]]; then
# Update the Dockerhub README
PUBLISH_DOCKERHUB=true
# Not main, and not -dev
elif [[ $STATE_ISDEV == false ]]; then
if [[ $STATE_VERSIONPATCH -eq 0 ]]; then
# A just-forked branch
PUBLISH_GITHUB_RELEASE=false
fi
fi
fi

# Only run Envoy release CI if explictly set
if { [[ "$PRESUBMIT" != 'true' ]] && [[ "$POSTSUBMIT" != 'true' ]]; } || [[ $BUILD_REASON == "Schedule" ]]; then
PUBLISH_GITHUB_RELEASE=false
fi

echo "##vso[task.setvariable variable=githubRelease;isoutput=true]${PUBLISH_GITHUB_RELEASE}"
echo "##vso[task.setvariable variable=dockerhub;isoutput=true]${PUBLISH_DOCKERHUB}"
36 changes: 36 additions & 0 deletions .azure-pipelines/env/decide-what-to-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash -e

RUN_BUILD=true
RUN_CHECKS=true
RUN_DOCKER=true
RUN_PACKAGING=true
RUN_RELEASE_TESTS=true

if [[ $CHANGED_MOBILEONLY == true || $CHANGED_DOCSONLY == true ]]; then
RUN_BUILD=false
RUN_CHECKS=false
RUN_DOCKER=false
RUN_PACKAGING=false
fi
if [[ $CHANGED_EXAMPLESONLY == true ]]; then
RUN_CHECKS=false
fi
if [[ "$ISSTABLEBRANCH" == True && -n "$POSTSUBMIT" && $STATE_ISDEV == false ]]; then
RUN_RELEASE_TESTS=false
fi

# Run ~everything in postsubmit
if [[ $BUILD_REASON != "PullRequest" ]]; then
echo "##vso[task.setvariable variable=build;isoutput=true]true"
echo "##vso[task.setvariable variable=checks;isoutput=true]true"
echo "##vso[task.setvariable variable=docker;isoutput=true]true"
echo "##vso[task.setvariable variable=packaging;isoutput=true]true"
echo "##vso[task.setvariable variable=releaseTests;isoutput=true]${RUN_RELEASE_TESTS}"
exit 0
fi

echo "##vso[task.setvariable variable=build;isoutput=true]${RUN_BUILD}"
echo "##vso[task.setvariable variable=checks;isoutput=true]${RUN_CHECKS}"
echo "##vso[task.setvariable variable=docker;isoutput=true]${RUN_DOCKER}"
echo "##vso[task.setvariable variable=packaging;isoutput=true]${RUN_PACKAGING}"
echo "##vso[task.setvariable variable=releaseTests;isoutput=true]${RUN_RELEASE_TESTS}"
37 changes: 37 additions & 0 deletions .azure-pipelines/env/detect-repo-changes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash -e

# Only exclude checks in pull requests.
if [[ $BUILD_REASON != "PullRequest" ]]; then
echo "##vso[task.setvariable variable=mobileOnly;isoutput=true]false"
echo "##vso[task.setvariable variable=docsOnly;isoutput=true]false"
echo "##vso[task.setvariable variable=examplesOnly;isoutput=true]false"
echo "##vso[task.setvariable variable=requirements;isoutput=true]true"
exit 0
fi

CHANGE_TARGET="origin/$TARGET_BRANCH"

echo "Comparing changes ${CHANGE_TARGET}...HEAD"
CHANGED_PATHS=$(git diff --name-only "${CHANGE_TARGET}"...HEAD | cut -d/ -f1 | sort -u | jq -sR 'rtrimstr("\n") | split("\n")')
echo "$CHANGED_PATHS" | jq '.'
CHANGED_PATH_COUNT=$(echo "$CHANGED_PATHS" | jq '. | length')
CHANGED_MOBILE_ONLY=false
CHANGED_DOCS_ONLY=false
CHANGED_EXAMPLES_ONLY=false

CHANGED_MOBILE=$(echo "$CHANGED_PATHS" | jq '. as $A | "mobile" | IN($A[])')
if [[ $CHANGED_MOBILE == true && $CHANGED_PATH_COUNT -eq 1 ]]; then
CHANGED_MOBILE_ONLY=true
fi
CHANGED_DOCS=$(echo "$CHANGED_PATHS" | jq '. as $A | "docs" | IN($A[])')
if [[ $CHANGED_DOCS == true && $CHANGED_PATH_COUNT -eq 1 ]]; then
CHANGED_DOCS_ONLY=true
fi
CHANGED_EXAMPLES=$(echo "$CHANGED_PATHS" | jq '. as $A | "examples" | IN($A[])')
if [[ $CHANGED_EXAMPLES == true && $CHANGED_PATH_COUNT -eq 1 ]]; then
CHANGED_EXAMPLES_ONLY=true
fi

echo "##vso[task.setvariable variable=mobileOnly;isoutput=true]${CHANGED_MOBILE_ONLY}"
echo "##vso[task.setvariable variable=docsOnly;isoutput=true]${CHANGED_DOCS_ONLY}"
echo "##vso[task.setvariable variable=examplesOnly;isoutput=true]${CHANGED_EXAMPLES_ONLY}"
22 changes: 22 additions & 0 deletions .azure-pipelines/env/set-dev-release-envs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash -e

VERSION_DEV=$(cut -d- -f2 VERSION.txt)
VERSION_PATCH=$(cut -d- -f1 VERSION.txt | rev | cut -d. -f1 | rev)
echo "##vso[task.setvariable variable=versionPatch;isoutput=true]$VERSION_PATCH"
if [[ $VERSION_DEV == "dev" ]]; then
echo "##vso[task.setvariable variable=isDev;isoutput=true]true"
else
if [[ $BUILD_REASON == "PullRequest" ]]; then
# Check to make sure that it was this PR that changed the version, otherwise fail
# as the branch needs to be reopened first.
# NB: this will not stop a PR that has already passed checks from being landed.
DIFF_TARGET_BRANCH="origin/$TARGET_BRANCH"
DIFF_REF=$(git merge-base HEAD "${DIFF_TARGET_BRANCH}")
CHANGES=$(git diff "$DIFF_REF" HEAD VERSION.txt)
if [[ -z "$CHANGES" ]]; then
echo "VERSION.txt is not a development version. Please re-open the branch before making further changes" >&2
exit 1
fi
fi
echo "##vso[task.setvariable variable=isDev;isoutput=true]false"
fi
31 changes: 0 additions & 31 deletions .github/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ checks:
required: true
on-run:
- mobile-cc
mobile-compile-time-options:
name: Mobile/Compile time options
on-run:
- mobile-compile-time-cc
- mobile-compile-time-options
mobile-coverage:
name: Mobile/Coverage
required: true
Expand Down Expand Up @@ -217,32 +212,6 @@ run:
- test/integration/*
- test/mocks/**/*
- test/test_common/**/*
mobile-compile-time-cc:
paths:
- .bazelrc
- .bazelversion
- .github/config.yml
- api/**/*
- bazel/external/quiche.BUILD
- bazel/repository_locations.bzl
- envoy/**/*
- mobile/.bazelrc
- mobile/**/*
- source/**/*
- test/config/**/*
- test/integration/*
- test/mocks/**/*
- test/test_common/**/*
mobile-compile-time-options:
paths:
- .bazelrc
- .bazelversion
- .github/config.yml
- bazel/external/quiche.BUILD
- bazel/repository_locations.bzl
- mobile/.bazelrc
- mobile/**/*
- tools/code_format/check_format.py
mobile-coverage:
paths:
- .bazelrc
Expand Down
Loading

0 comments on commit 1e9c894

Please sign in to comment.