MCPcopy Create free account
hub / github.com/github/gh-aw / generateFirewallLogParsingStep

Function generateFirewallLogParsingStep

pkg/workflow/engine_firewall_support.go:125–166  ·  view source on GitHub ↗

generateFirewallLogParsingStep creates a GitHub Actions step to parse firewall logs and create step summary.

(workflowName string, workflowData *WorkflowData)

Source from the content-addressed store, hash-verified

123
124// generateFirewallLogParsingStep creates a GitHub Actions step to parse firewall logs and create step summary.
125func generateFirewallLogParsingStep(workflowName string, workflowData *WorkflowData) GitHubActionStep {
126 // Firewall logs are at a known location in the sandbox folder structure.
127 // On ARC/DinD, /tmp/gh-aw is not daemon-visible so logs land under runner.temp/gh-aw.
128 firewallLogsDir := constants.AWFProxyLogsDir
129 // For env: blocks, use ${{ runner.temp }} (Actions expression) since shell vars aren't expanded there.
130 firewallLogsDirEnv := constants.AWFProxyLogsDir
131 if isArcDindTopology(workflowData) {
132 firewallLogsDir = "${RUNNER_TEMP}/gh-aw/sandbox/firewall/logs"
133 firewallLogsDirEnv = "${{ runner.temp }}/gh-aw/sandbox/firewall/logs"
134 }
135 firewallDir := path.Dir(firewallLogsDir)
136
137 stepLines := []string{
138 " - name: Print firewall logs",
139 " if: always()",
140 " continue-on-error: true",
141 " env:",
142 " AWF_LOGS_DIR: " + firewallLogsDirEnv,
143 " run: |",
144 }
145
146 // When sudo is false (network isolation mode), AWF runs rootless so firewall files
147 // are not owned by root — skip the sudo chmod permission-fix step.
148 if !isAWFNetworkIsolationEnabled(workflowData) {
149 stepLines = append(stepLines,
150 " # Fix permissions on firewall logs/audit dirs so they can be uploaded as artifacts",
151 " # AWF runs with sudo, creating files owned by root",
152 fmt.Sprintf(" sudo chmod -R a+rX %s 2>/dev/null || true", firewallDir),
153 )
154 }
155
156 stepLines = append(stepLines,
157 " # Only run awf logs summary if awf command exists (it may not be installed if workflow failed before install step)",
158 " if command -v awf &> /dev/null; then",
159 " awf logs summary | tee -a \"$GITHUB_STEP_SUMMARY\"",
160 " else",
161 " echo 'AWF binary not installed, skipping firewall log summary'",
162 " fi",
163 )
164
165 return GitHubActionStep(stepLines)
166}
167
168// defaultGetSquidLogsSteps returns the steps for uploading and parsing Squid logs after
169// secret redaction. It is shared across engines (Claude, Codex, Copilot) whose

Calls 3

isArcDindTopologyFunction · 0.85
GitHubActionStepTypeAlias · 0.85