Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zalimeni/stopgap fix ci skip test skip #635

Closed
wants to merge 2 commits into from
Closed
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
23 changes: 18 additions & 5 deletions .github/scripts/check_skip_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,30 @@ set -euo pipefail

# Get the list of changed files
# Using `git merge-base` ensures that we're always comparing against the correct branch point.
#For example, given the commits:
# For example, given the commits:
#
# A---B---C---D---W---X---Y---Z # origin/main
# \---E---F # feature/branch
#
# ... `git merge-base origin/$SKIP_CHECK_BRANCH HEAD` would return commit `D`
# `...HEAD` specifies from the common ancestor to the latest commit on the current branch (HEAD)..
files_to_check=$(git diff --name-only "$(git merge-base origin/$SKIP_CHECK_BRANCH HEAD~)"...HEAD)
# ... `git merge-base origin/$SKIP_CHECK_BRANCH HEAD~` would return commit `D` for a `pull_request` event.
#
# `HEAD~` means that:
# - For `push` events to a protected branch, the merge base is the commit before HEAD (the latest commit
# before the push). The diff will come from the pushed changes, assuming the repo requires squash-merge.
# - For `pull_request` events, the merge base is the last common commit between the base ref
# (`origin/$skip_check_branch`) and the last "real" commit on the PR branch, before the PR branch
# merge commit added by GH. The diff will come from the changes in the PR branch.
skip_check_branch=${SKIP_CHECK_BRANCH:?SKIP_CHECK_BRANCH is required}
merge_base=$(git merge-base origin/$skip_check_branch HEAD~)
echo "merge_base: $merge_base"

# `...HEAD` specifies from the common ancestor to the latest commit on the current branch (HEAD).
echo "diff commits:"
git log "$merge_base...HEAD" --oneline
files_to_check=$(git diff --name-only $merge_base...HEAD)

# Define the directories to check
skipped_directories=("_doc/" ".changelog/")
skipped_directories=("_doc/" ".changelog/" ".github/")

# Loop through the changed files and find directories/files outside the skipped ones
files_to_check_array=($files_to_check)
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
name: build

# We now default to running this workflow on every push to every branch.
# We now default to running this workflow on every pull_request push
# in addition to protected branch push.
#
# This provides fast feedback when build issues occur, so they can be
# fixed prior to being merged to the main branch.
# fixed prior to being merged.
#
# If you want to opt out of this, and only run the build on certain branches
# please refer to the documentation on branch filtering here:
#
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpushbranchestagsbranches-ignoretags-ignore
#
on: [workflow_dispatch, push]
on:
push:
branches:
- main
- release/**
pull_request:
workflow_dispatch:

env:
PKG_NAME: "consul-dataplane"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/consul-dataplane-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: consul-dataplane-checks
on:
push:
branches:
- main
- 'release/*.*.x'
- main
- release/**
pull_request:

jobs:
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/reusable-conditional-skip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,18 @@ jobs:
outputs:
skip-ci: ${{ steps.check-changed-files.outputs.skip-ci }}
env:
SKIP_CHECK_BRANCH: ${{ github.head_ref || github.ref_name }}
# Use the base branch for PR, or the head of the current branch for push.
SKIP_CHECK_BRANCH: ${{ github.base_ref || github.ref_name }} # tmp test
steps:
- name: Ensure conditional check is allowed
if: ${{ !github.base_ref && !github.ref_protected }}
run: |
echo "Conditional skip requires a PR event with `base_ref` or `push` to a protected branch."
echo "github.base_ref: ${{ github.base_ref }}"
echo "github.ref_protected: ${{ github.ref_protected }}"
echo "github.ref_name: ${{ github.ref_name }}"
echo "Check the triggers of the calling workflow to ensure that these requirements are met."
exit 1
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
fetch-depth: 0
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/security-scan.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This job runs a non-blocking informational security scan on the repository.
# For release-blocking security scans, see .release/security-scan.hcl.
name: Security Scan

on:
Expand All @@ -9,6 +11,8 @@ on:
branches:
- main
- release/**
# paths-ignore only works for non-required checks.
# Jobs that are required for merge must use reusable-conditional-skip.yml.
paths-ignore:
- '_doc/**'
- '.changelog/**'
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<span>Consul Dataplane</span>
</h1>

Test skippable commit

Consul Dataplane is a lightweight process that manages Envoy for Consul service mesh workloads.

Consul Dataplane's design removes the need to run Consul client agents. Removing Consul client
Expand Down
Loading