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

V next #69

Merged
merged 8 commits into from
Feb 25, 2025
Merged
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
59 changes: 57 additions & 2 deletions .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,63 @@ jobs:
runs-on: ubuntu-latest
permissions:
pull-requests: write
if: contains(github.event.pull_request.labels.*.name, 'auto-approve') && (github.event.pull_request.user.login == 'hakenmt' || github.event.pull_request.user.login == 'github-bot')
actions: read
checks: read
if: contains(github.event.pull_request.labels.*.name, 'auto-approve') && contains('hakenmt,github-bot', github.event.pull_request.user.login)
steps:
- uses: hmarr/[email protected]
- name: wait-for-build
id: wait-for-build
env:
SHA: ${{ github.event.pull_request.head.sha }}
GH_TOKEN: ${{ github.token }}
TIMEOUT: 600
INTERVAL: 10
run: |
START_TIME=$(date +%s)
TERMINATING_STATUS=("completed" "action_required" "cancelled" "failure" "neutral" "skipped" "stale" "success" "timed_out" )

while true; do
# Get the latest build workflow run for this PR
WORKFLOW_RUN=$(gh api /repos/${{ github.repository }}/actions/runs?head_sha=$SHA \
--jq '.workflow_runs | map(select(.head_sha == "${{ github.event.pull_request.head.sha }}" and .name == "build"))[0]')

if [ -z "$WORKFLOW_RUN" ]; then
echo "No build workflow run found for the latest commit."
else
STATUS=$(echo "$WORKFLOW_RUN" | jq -r '.conclusion')

if [[ ${TERMINATING_STATUS[@]} =~ "$STATUS" ]]; then
echo "Build workflow finished."
echo "conclusion=$STATUS" >> $GITHUB_OUTPUT
break
else
echo "Build workflow status: $STATUS. Waiting for success..."
fi
fi

# Check if timeout has been reached
CURRENT_TIME=$(date +%s)
ELAPSED_TIME=$((CURRENT_TIME - START_TIME))
if [ $ELAPSED_TIME -ge $TIMEOUT ]; then
echo "Timeout reached. Build workflow did not succeed within $TIMEOUT seconds."
echo "conclusion=timed_out" >> $GITHUB_OUTPUT
break
fi

# Wait for the specified interval before checking again
sleep $INTERVAL
done

- name: fail
id: fail
if: ${{ !contains('success,neutral,skipped', steps.wait-for-build.outputs.conclusion) }}
run: |
echo "Did not reach successful build workflow state. Conclusion: ${{ steps.wait-for-build.outputs.conclusion }}"
exit 1

- name: auto-approve
id: auto-approve
uses: hmarr/[email protected]
if: contains('success,neutral,skipped', steps.wait-for-build.outputs.conclusion)
with:
github-token: ${{ github.token }}
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: test
on:
workflow_run:
workflows: ["review"]
workflows: ["review", "auto-approve"]
types:
- completed

Expand Down
16 changes: 11 additions & 5 deletions cdk/Configs/cw-agent-onebox-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,37 +37,43 @@
},
"logs": {
"metrics_collected": {
"emf": {}
"emf": {}
},
"logs_collected": {
"files": {
"collect_list": [
{
"file_path": "/var/log/cfn-init-cmd.log",
"log_group_name": "cfn-init-cmd.log",
"log_stream_name": "${aws:InstanceId}",
"log_stream_name": "{instance_id}",
"timestamp_format": "%H: %M: %S%y%b%-d"
},
{
"file_path": "/var/log/cfn-init.log",
"log_group_name": "cfn-init.log",
"log_stream_name": "${aws:InstanceId}",
"log_stream_name": "{instance_id}",
"timestamp_format": "%H: %M: %S%y%b%-d"
},
{
"file_path": "/var/log/cloud-init-output.log",
"log_group_name": "cloud-init-output.log",
"log_stream_name": "${aws:InstanceId}",
"log_stream_name": "{instance_id}",
"timestamp_format": "%H: %M: %S%y%b%-d"
},
{
"file_path": "/var/log/cloud-init.log",
"log_group_name": "cloud-init.log",
"log_stream_name": "${aws:InstanceId}",
"log_stream_name": "{instance_id}",
"timestamp_format": "%H: %M: %S%y%b%-d"
}
]
}
}
},
"traces": {
"traces_collected": {
"xray": {},
"otlp": {}
}
}
}