gh_workflow_parser/commands/
create_issue_from_run.rs

1use super::{WorkflowKind, LEVENSHTEIN_THRESHOLD};
2use crate::{
3    err_msg_parse,
4    errlog::ErrorLog,
5    gh,
6    issue::{FailedJob, Issue},
7    util,
8};
9use std::error::Error;
10
11pub fn create_issue_from_run(
12    github_cli: Box<dyn gh::GitHub>,
13    run_id: &str,
14    labels: &str,
15    kind: WorkflowKind,
16    dry_run: bool,
17    no_duplicate: bool,
18) -> Result<(), Box<dyn std::error::Error>> {
19    // Run the GitHub CLI to get the workflow run
20    let run_summary = github_cli.run_summary(None, run_id)?;
21    log::info!("Run summary: {run_summary}");
22
23    let failed_jobs = util::take_lines_with_failed_jobs(run_summary);
24    if failed_jobs.is_empty() {
25        log::error!("No failed jobs found! Exiting...");
26        std::process::exit(1);
27    }
28
29    log::info!("Failed jobs: {:?}", failed_jobs);
30    let failed_job_ids = util::id_from_job_lines(&failed_jobs);
31    let failed_job_logs: Vec<String> = failed_job_ids
32        .iter()
33        .map(|job_id| github_cli.failed_job_log(None, job_id))
34        .collect::<Result<Vec<String>, Box<dyn Error>>>()?;
35
36    log::info!("Got {} failed job log(s)", failed_job_logs.len());
37
38    let failed_logs = failed_job_logs
39        .iter()
40        .zip(failed_job_ids.iter())
41        .map(|(log, id)| ErrorLog::new(id.to_string(), log.to_string()))
42        .collect::<Result<Vec<ErrorLog>, Box<dyn Error>>>()?;
43
44    let gh_issue = parse_to_gh_issue(
45        failed_logs,
46        github_cli.default_repo(),
47        run_id.to_owned(),
48        labels.to_string(),
49        kind,
50    )?;
51    if no_duplicate {
52        let similar_issues = github_cli.issue_bodies_open_with_label(None, labels)?;
53        // Check how similar the issues are
54        let smallest_distance = issue_text_similarity(&gh_issue.body(), &similar_issues);
55        log::info!("Smallest levenshtein distance to similar issue: {smallest_distance} (Similarity threshold={LEVENSHTEIN_THRESHOLD})");
56        match smallest_distance {
57            0 => {
58                log::warn!("An issue with the exact same body already exists. Exiting...");
59                std::process::exit(0);
60            },
61            _ if smallest_distance < LEVENSHTEIN_THRESHOLD => {
62                log::warn!("An issue with a similar body already exists. Exiting...");
63                std::process::exit(0);
64            },
65            _ => log::info!("No similar issue found. Continuing..."),
66        }
67    }
68    if dry_run {
69        println!("####################################");
70        println!("DRY RUN MODE! The following issue would be created:");
71        println!("==== ISSUE TITLE ==== \n{}", gh_issue.title());
72        println!("==== ISSUE LABEL(S) ==== \n{}", gh_issue.labels().join(","));
73        println!("==== START OF ISSUE BODY ==== \n{}", gh_issue.body());
74        println!("==== END OF ISSUE BODY ====");
75    } else {
76        log::debug!("Creating an issue in the remote repository with the following characteristics:\n==== ISSUE TITLE ==== \n{title}\n==== ISSUE LABEL(S) ==== \n{labels}\n==== START OF ISSUE BODY ==== \n{body}\n==== END OF ISSUE BODY ====", title = gh_issue.title(), labels = gh_issue.labels().join(","), body = gh_issue.body());
77        github_cli.create_issue(None, gh_issue.title(), &gh_issue.body(), gh_issue.labels())?;
78    }
79    Ok(())
80}
81
82/// Calculate the smallest levenshtein distance between the issue body and the other issues with the same label
83fn issue_text_similarity(issue_body: &str, other_issues: &[String]) -> usize {
84    let issue_body_without_timestamps = util::remove_timestamps(issue_body);
85
86    let smallest_distance = other_issues
87        .iter()
88        .map(|other_issue_body| {
89            distance::levenshtein(
90                &issue_body_without_timestamps,
91                &util::remove_timestamps(other_issue_body),
92            )
93        })
94        .min()
95        .unwrap_or(usize::MAX);
96
97    smallest_distance
98}
99
100fn parse_to_gh_issue(
101    errlogs: Vec<ErrorLog>,
102    repo: &str,
103    run_id: String,
104    label: String,
105    kind: WorkflowKind,
106) -> Result<Issue, Box<dyn Error>> {
107    let failed_jobs: Vec<FailedJob> = errlogs
108        .iter()
109        .map(|errlog| {
110            let err_summary = err_msg_parse::parse_error_message(errlog.no_prefix_log(), kind)?;
111            Ok(FailedJob::new(
112                errlog.failed_job().to_owned(),
113                errlog.job_id().to_owned(),
114                gh::util::repo_url_to_job_url(repo, &run_id, errlog.job_id()),
115                errlog.failed_step().to_owned(),
116                err_summary,
117            ))
118        })
119        .collect::<Result<Vec<FailedJob>, Box<dyn Error>>>()?;
120
121    let issue = Issue::new(
122        run_id.to_string(),
123        gh::util::repo_url_to_run_url(repo, &run_id),
124        failed_jobs,
125        label,
126    );
127    Ok(issue)
128}
129
130#[cfg(test)]
131mod tests {
132    use super::*;
133    use pretty_assertions::assert_eq;
134
135    const EXAMPLE_ISSUE_BODY_0: &str = r#"**Run ID**: 7858139663 [LINK TO RUN]( https://github.com/luftkode/distro-template/actions/runs/7850874958)
136
137**2 jobs failed:**
138- **`Test template xilinx`**
139- **`Test template raspberry`**
140
141### `Test template xilinx` (ID 21442749267)
142**Step failed:** `📦 Build yocto image`
143\
144**Log:** https://github.com/luftkode/distro-template/actions/runs/7858139663/job/21442749267
145\
146*Best effort error summary*:
147```
148Yocto error: ERROR: No recipes available for: ...
149```
150### `Test template raspberry` (ID 21442749166)
151**Step failed:** `📦 Build yocto image`
152\
153**Log:** https://github.com/luftkode/distro-template/actions/runs/7858139663/job/21442749166
154\
155*Best effort error summary*:
156```
157Yocto error: ERROR: No recipes available for: ...
158```"#;
159
160    const EXAMPLE_ISSUE_BODY_1: &str = r#"**Run ID**: 7858139663 [LINK TO RUN]( https://github.com/luftkode/distro-template/actions/runs/7850874958)
161
162**2 jobs failed:**
163- **`Test template xilinx`**
164- **`Test template raspberry`**
165
166### `Test template xilinx` (ID 21442749267)
167**Step failed:** `📦 Build yocto image`
168\
169**Log:** https://github.com/luftkode/distro-template/actions/runs/7858139663/job/21442749267
170\
171*Best effort error summary*:
172```
173Yocto error: ERROR: No recipes available for: ...
174```
175### `Test template raspberry` (ID 21442749166)
176**Step failed:** `📦 Build yocto image`
177\
178**Log:** https://github.com/luftkode/distro-template/actions/runs/7858139663/job/21442749166
179\
180*Best effort error summary*:
181```
182Yocto error: ERROR: No recipes available for: ...
183```"#;
184
185    #[test]
186    fn test_issue_body_distance() {
187        let issue_0 = EXAMPLE_ISSUE_BODY_0.to_string();
188        let issue_1 = EXAMPLE_ISSUE_BODY_1.to_string();
189        let distance = issue_text_similarity(&issue_0, &[issue_1]);
190        assert_eq!(distance, 0);
191    }
192
193    /// Identical except for very similar run and job IDs
194    #[test]
195    fn test_issue_body_distance_edit_minimal_diff() {
196        let issue_0 = EXAMPLE_ISSUE_BODY_0.to_string();
197        let issue_1 = EXAMPLE_ISSUE_BODY_1.to_string();
198        let new_run_id = "7858139660";
199        let new_job0_id = "21442749260";
200        let new_job1_id = "21442749200";
201
202        let issue_1 = issue_1.replace("7858139663", new_run_id);
203        let issue_1 = issue_1.replace("21442749267", new_job0_id);
204        let issue_1 = issue_1.replace("21442749166", new_job1_id);
205
206        let distance = issue_text_similarity(&issue_0, &[issue_1]);
207        assert_eq!(distance, 0); // No difference as IDs are now masked when comparing
208    }
209
210    /// Identical except for as different run and job IDs as possible
211    #[test]
212    fn test_issue_body_distance_edit_largest_similar() {
213        let issue_0 = EXAMPLE_ISSUE_BODY_0.to_string();
214        let issue_1 = EXAMPLE_ISSUE_BODY_1.to_string();
215        let new_run_id = "0000000000";
216        let new_job0_id = "00000000000";
217        let new_job1_id = "33333333333";
218
219        let issue_1 = issue_1.replace("7858139663", new_run_id);
220        let issue_1 = issue_1.replace("21442749267", new_job0_id);
221        let issue_1 = issue_1.replace("21442749166", new_job1_id);
222
223        let distance = issue_text_similarity(&issue_0, &[issue_1]);
224        assert_eq!(distance, 0); // No difference as IDs are now masked when comparing
225    }
226
227    /// Smallest difference in job and run IDs but different in other ways and should be treated as different.
228    #[test]
229    fn test_issue_body_distance_edit_minimal_but_different() {
230        let issue_0 = EXAMPLE_ISSUE_BODY_0.to_string();
231        let issue_1 = EXAMPLE_ISSUE_BODY_1.to_string();
232        let new_run_id = "7858139660";
233        let new_job0_id = "21442749260";
234        let new_job1_id = "21442749200";
235
236        let issue_1 = issue_1.replace("7858139663", new_run_id);
237        let issue_1 = issue_1.replace("21442749267", new_job0_id);
238        let issue_1 = issue_1.replace("21442749166", new_job1_id);
239        let issue_1 = issue_1.replace(
240            "Yocto error: ERROR: No recipes available for: ...",
241            "ERROR: fetcher failure. malformed url. Attempting to fetch from ${SOURCE_MIRROR_URL}",
242        );
243
244        let distance = issue_text_similarity(&issue_0, &[issue_1]);
245        assert_eq!(distance, 142);
246    }
247
248    // Regression test for https://github.com/luftkode/gh-workflow-parser/issues/9
249    /// Large issue text with many timestamps doesn't make the issues dissimilar
250    #[test]
251    fn test_issue9_similar_with_frequest_timestamps() {
252        let distance = issue_text_similarity(
253            ISSUE_FREQUENT_TIMESTAMPS_TEXT1,
254            &[ISSUE_FREQUENT_TIMESTAMPS_TEXT2.to_string()],
255        );
256
257        assert!(distance < LEVENSHTEIN_THRESHOLD, "Distance: {distance}");
258    }
259
260    const ISSUE_FREQUENT_TIMESTAMPS_TEXT1: &'static str = r#"**Run ID**: 8072883145 [LINK TO RUN](https://github.com/luftkode/distro-template/actions/runs/8072883145)
261
262**1 job failed:**
263- **`Test template xilinx`**
264
265### `Test template xilinx` (ID 22055505284)
266**Step failed:** `📦 Build yocto image`
267\
268**Log:** https://github.com/luftkode/distro-template/actions/runs/8072883145/job/22055505284
269\
270*Best effort error summary*:
271```
272##[group]Run set -ou pipefail
273set -ou pipefail
274just --yes build-ci-image 2>&1 | tee "yocto_build.log"
275shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
276env:
277  REGISTRY: ghcr.io
278  CARGO_TERM_COLOR: always
279  SSH_AUTH_SOCK: /tmp/ssh-XXXXXXJhUcQF/agent.2944549
280  CLONE_TO_DIR: clone-to-dir
281  YOCTO_BUILD_LOG: yocto_build.log
282##[endgroup]
283ABS_KAS_FRAG_CFG_DIR: /opt/github_runner_yocto/_work/distro-template/distro-template/clone-to-dir/test-template-ci-xilinx-distro/distro-builder-common/kas-config-fragments
284[[BEFORE RUN]] - copying kas config: build_ci.yml from: /opt/github_runner_yocto/_work/distro-template/distro-template/clone-to-dir/test-template-ci-xilinx-distro/distro-builder-common/kas-config-fragments to: /opt/github_runner_yocto/_work/distro-template/distro-template/clone-to-dir/test-template-ci-xilinx-distro/main-image
285---
286Setting bitbake environment variables: export BB_ENV_PASSTHROUGH_ADDITIONS=YOCTO_BRANCH; export YOCTO_BRANCH=nanbield;
287---
288Running command(s): just in-container-build-ci-image
289---
290Not in container, running command(s) through: "docker compose" with image=image
291---
292 Network distro-builder-common_default  Creating
293 Network distro-builder-common_default  Created
294~/kas/run-kas shell "main-image/image.yml:main-image/build_ci.yml" -c "bitbake -c cleansstate virtual/bootloader virtual/kernel"
2952024-02-28 00:03:44 - INFO     - run-kas 4.2 started
2962024-02-28 00:03:44 - INFO     - /app/main-image$ git rev-parse --show-toplevel
2972024-02-28 00:03:44 - INFO     - /app/main-image$ git rev-parse --show-toplevel
2982024-02-28 00:03:44 - INFO     - /app/main-image$ git rev-parse --show-toplevel
2992024-02-28 00:03:44 - INFO     - /app/yocto$ git clone -q https://git.yoctoproject.org/poky /app/yocto/poky/
3002024-02-28 00:03:44 - INFO     - /app/yocto$ git clone -q https://github.com/openembedded/meta-openembedded /app/yocto/layers/meta-openembedded
3012024-02-28 00:03:44 - INFO     - /app/yocto$ git clone -q git@github.com:luftkode/meta-airborne.git /app/yocto/layers/meta-airborne
3022024-02-28 00:03:44 - INFO     - /app/yocto$ git clone -q git@github.com:luftkode/meta-skytem-xilinx.git /app/yocto/layers/meta-skytem-xilinx
3032024-02-28 00:03:44 - INFO     - /app/yocto$ git clone -q https://github.com/Xilinx/meta-xilinx /app/yocto/layers/meta-xilinx
3042024-02-28 00:03:44 - INFO     - /app/yocto$ git clone -q https://github.com/Xilinx/meta-xilinx-tools /app/yocto/layers/meta-xilinx-tools
3052024-02-28 00:03:44 - INFO     - /app/yocto$ git clone -q https://git.yoctoproject.org/meta-virtualization/ /app/yocto/layers/meta-virtualization
3062024-02-28 00:03:44 - INFO     - /app/yocto$ git clone -q git@github.com:rust-embedded/meta-rust-bin.git /app/yocto/layers/meta-rust-bin
3072024-02-28 00:03:45 - ERROR    - Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
3082024-02-28 00:03:45 - ERROR    - Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
3092024-02-28 00:03:45 - ERROR    - Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
3102024-02-28 00:03:45 - INFO     - Repository meta-virtualization cloned
3112024-02-28 00:03:45 - INFO     - /app/yocto/layers/meta-virtualization$ git remote set-url origin https://git.yoctoproject.org/meta-virtualization/
3122024-02-28 00:03:45 - INFO     - /app/yocto/layers/meta-virtualization$ git cat-file -t ac125d881f34ff356390e19e02964f8980d4ec38
3132024-02-28 00:03:45 - INFO     - Repository meta-virtualization already contains ac125d881f34ff356390e19e02964f8980d4ec38 as commit
3142024-02-28 00:03:45 - INFO     - Repository meta-xilinx-tools cloned
3152024-02-28 00:03:45 - INFO     - /app/yocto/layers/meta-xilinx-tools$ git remote set-url origin https://github.com/Xilinx/meta-xilinx-tools
3162024-02-28 00:03:45 - INFO     - /app/yocto/layers/meta-xilinx-tools$ git cat-file -t 92b449c333e3a991735388f4cc0e38ec97e1f9ad
3172024-02-28 00:03:45 - INFO     - Repository meta-xilinx-tools already contains 92b449c333e3a991735388f4cc0e38ec97e1f9ad as commit
3182024-02-28 00:03:46 - INFO     - Repository meta-xilinx cloned
3192024-02-28 00:03:46 - INFO     - /app/yocto/layers/meta-xilinx$ git remote set-url origin https://github.com/Xilinx/meta-xilinx
3202024-02-28 00:03:46 - INFO     - /app/yocto/layers/meta-xilinx$ git cat-file -t a1c7db00727d02b8cd47d665fee86f75b0f83080
3212024-02-28 00:03:46 - INFO     - Repository meta-xilinx already contains a1c7db00727d02b8cd47d665fee86f75b0f83080 as commit
3222024-02-28 00:03:46 - INFO     - Repository meta-skytem-xilinx cloned
3232024-02-28 00:03:46 - INFO     - /app/yocto/layers/meta-skytem-xilinx$ git remote set-url origin git@github.com:luftkode/meta-skytem-xilinx.git
3242024-02-28 00:03:46 - INFO     - /app/yocto/layers/meta-skytem-xilinx$ git cat-file -t e8cf7aaa8c9d4d72a702fa0577421446aa38b223
3252024-02-28 00:03:46 - INFO     - Repository meta-skytem-xilinx already contains e8cf7aaa8c9d4d72a702fa0577421446aa38b223 as commit
3262024-02-28 00:03:46 - INFO     - Repository meta-rust-bin cloned
3272024-02-28 00:03:46 - INFO     - /app/yocto/layers/meta-rust-bin$ git remote set-url origin git@github.com:rust-embedded/meta-rust-bin.git
3282024-02-28 00:03:46 - INFO     - /app/yocto/layers/meta-rust-bin$ git cat-file -t 019e3b0073510e6f39fac23d9a3c2dd6d793a2fe
3292024-02-28 00:03:46 - INFO     - Repository meta-rust-bin already contains 019e3b0073510e6f39fac23d9a3c2dd6d793a2fe as commit
3302024-02-28 00:03:48 - INFO     - Repository meta-airborne cloned
3312024-02-28 00:03:48 - INFO     - /app/yocto/layers/meta-airborne$ git remote set-url origin git@github.com:luftkode/meta-airborne.git
3322024-02-28 00:03:48 - INFO     - /app/yocto/layers/meta-airborne$ git cat-file -t fa6e5f001067ffe6f19e038a8a87cc06d409cafa
3332024-02-28 00:03:48 - INFO     - Repository meta-airborne already contains fa6e5f001067ffe6f19e038a8a87cc06d409cafa as commit
3342024-02-28 00:03:49 - INFO     - Repository meta-openembedded cloned
3352024-02-28 00:03:49 - INFO     - /app/yocto/layers/meta-openembedded$ git remote set-url origin https://github.com/openembedded/meta-openembedded
3362024-02-28 00:03:50 - INFO     - /app/yocto/layers/meta-openembedded$ git cat-file -t da9063bdfbe130f424ba487f167da68e0ce90e7d
3372024-02-28 00:03:50 - INFO     - Repository meta-openembedded already contains da9063bdfbe130f424ba487f167da68e0ce90e7d as commit
3382024-02-28 00:04:00 - INFO     - Repository poky cloned
3392024-02-28 00:04:00 - INFO     - /app/yocto/poky/$ git remote set-url origin https://git.yoctoproject.org/poky
3402024-02-28 00:04:00 - INFO     - /app/yocto/poky/$ git cat-file -t 1a5c00f00c14cee3ba5d39c8c8db7a9738469eab
3412024-02-28 00:04:00 - INFO     - Repository poky already contains 1a5c00f00c14cee3ba5d39c8c8db7a9738469eab as commit
3422024-02-28 00:04:00 - INFO     - /app/yocto/poky/$ git status -s
3432024-02-28 00:04:00 - INFO     - /app/yocto/poky/$ git checkout -q 1a5c00f00c14cee3ba5d39c8c8db7a9738469eab
3442024-02-28 00:04:01 - INFO     - /app/yocto/layers/meta-openembedded$ git status -s
3452024-02-28 00:04:01 - INFO     - /app/yocto/layers/meta-openembedded$ git checkout -q da9063bdfbe130f424ba487f167da68e0ce90e7d
3462024-02-28 00:04:01 - INFO     - /app/yocto/layers/meta-airborne$ git status -s
3472024-02-28 00:04:01 - INFO     - /app/yocto/layers/meta-airborne$ git checkout -q fa6e5f001067ffe6f19e038a8a87cc06d409cafa
3482024-02-28 00:04:01 - INFO     - /app/yocto/layers/meta-skytem-xilinx$ git status -s
3492024-02-28 00:04:01 - INFO     - /app/yocto/layers/meta-skytem-xilinx$ git checkout -q e8cf7aaa8c9d4d72a702fa0577421446aa38b223
3502024-02-28 00:04:01 - INFO     - /app/yocto/layers/meta-xilinx$ git status -s
3512024-02-28 00:04:01 - INFO     - /app/yocto/layers/meta-xilinx$ git checkout -q a1c7db00727d02b8cd47d665fee86f75b0f83080
3522024-02-28 00:04:01 - INFO     - /app/yocto/layers/meta-xilinx-tools$ git status -s
3532024-02-28 00:04:01 - INFO     - /app/yocto/layers/meta-xilinx-tools$ git checkout -q 92b449c333e3a991735388f4cc0e38ec97e1f9ad
3542024-02-28 00:04:01 - INFO     - /app/yocto/layers/meta-virtualization$ git status -s
3552024-02-28 00:04:01 - INFO     - /app/yocto/layers/meta-virtualization$ git checkout -q ac125d881f34ff356390e19e02964f8980d4ec38
3562024-02-28 00:04:01 - INFO     - /app/yocto/layers/meta-rust-bin$ git status -s
3572024-02-28 00:04:01 - INFO     - /app/yocto/layers/meta-rust-bin$ git checkout -q 019e3b0073510e6f39fac23d9a3c2dd6d793a2fe
3582024-02-28 00:04:01 - INFO     - /app/yocto/poky/$ /tmp/tmpm4x_iz34/get_bb_env /app/yocto/build
3592024-02-28 00:04:01 - INFO     - To start the default build, run: bitbake -c build test-template-ci-xilinx-image package-index
360Loading cache...done.
361Loaded 0 entries from dependency cache.
362Parsing recipes...ERROR: ParseError at /app/yocto/build/../layers/meta-skytem-xilinx/recipes-bundles/zynq-update-bundle/zynq-update-bundle.bb:1: Could not inherit file classes/bundle.bbclass
363ERROR: Parsing halted due to errors, see error messages above
364
365Summary: There were 2 ERROR messages, returning a non-zero exit code.
3662024-02-28 00:05:18 - ERROR    - Shell returned non-zero exit status
3672024-02-28 00:05:18 - ERROR    - Command "/bin/bash -c 'bitbake -c cleansstate virtual/bootloader virtual/kernel'" failed with error 1
368error: Recipe `in-container-build-ci-image` failed on line 30 with exit code 1
369error: Recipe `run-in-docker` failed with exit code 1
370error: Recipe `build-ci-image` failed with exit code 1
371##[error]Process completed with exit code 1.
372##[group]Run cargo install gh-workflow-parser --profile release-ci && gh-workflow-parser --version
373cargo install gh-workflow-parser --profile release-ci && gh-workflow-parser --version
374failure_log_abs_path=$( gh-workflow-parser locate-failure-log --input-file="yocto_build.log" --kind=yocto )
375failure_log_basename=$( basename "${failure_log_abs_path}" )
376echo "failure_log_abs_path=${failure_log_abs_path}"
377echo "failure_log_basename=${failure_log_basename}"
378echo "YOCTO_FAILED_LOG_PATH=${failure_log_abs_path}" >> $GITHUB_ENV
379echo "YOCTO_FAILED_LOG_BASENAME=${failure_log_basename}" >> $GITHUB_ENV
380shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
381env:
382  REGISTRY: ghcr.io
383  CARGO_TERM_COLOR: always
384  SSH_AUTH_SOCK: /tmp/ssh-XXXXXXJhUcQF/agent.2944549
385  CLONE_TO_DIR: clone-to-dir
386  YOCTO_BUILD_LOG: yocto_build.log
387##[endgroup]
388    Updating crates.io index
389     Ignored package `gh-workflow-parser v0.5.3` is already installed, use --force to override
390gh-workflow-parser 0.5.3
391INFO Locating failure log for kind: Yocto
392INFO Reading log file: "yocto_build.log"
393ERROR No log file line found
394##[error]Process completed with exit code 1.
395##[group]Run actions/upload-artifact@v4
396with:
397  retention-days: 7
398  if-no-files-found: warn
399  compression-level: 6
400  overwrite: false
401env:
402  REGISTRY: ghcr.io
403  CARGO_TERM_COLOR: always
404  SSH_AUTH_SOCK: /tmp/ssh-XXXXXXJhUcQF/agent.2944549
405  CLONE_TO_DIR: clone-to-dir
406  YOCTO_BUILD_LOG: yocto_build.log
407##[endgroup]
408##[error]Input required and not supplied: path
409```"#;
410
411    const ISSUE_FREQUENT_TIMESTAMPS_TEXT2: &'static str = r#"**Run ID**: 8057183947 [LINK TO RUN](https://github.com/luftkode/distro-template/actions/runs/8057183947)
412
413**1 job failed:**
414- **`Test template xilinx`**
415
416### `Test template xilinx` (ID 22007767507)
417**Step failed:** `📦 Build yocto image`
418\
419**Log:** https://github.com/luftkode/distro-template/actions/runs/8057183947/job/22007767507
420\
421*Best effort error summary*:
422```
423##[group]Run set -ou pipefail
424set -ou pipefail
425just --yes build-ci-image 2>&1 | tee "yocto_build.log"
426shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
427env:
428  REGISTRY: ghcr.io
429  CARGO_TERM_COLOR: always
430  SSH_AUTH_SOCK: /tmp/ssh-XXXXXXooAvJr/agent.4134531
431  CLONE_TO_DIR: clone-to-dir
432  YOCTO_BUILD_LOG: yocto_build.log
433##[endgroup]
434ABS_KAS_FRAG_CFG_DIR: /opt/github_runner_yocto/_work/distro-template/distro-template/clone-to-dir/test-template-ci-xilinx-distro/distro-builder-common/kas-config-fragments
435[[BEFORE RUN]] - copying kas config: build_ci.yml from: /opt/github_runner_yocto/_work/distro-template/distro-template/clone-to-dir/test-template-ci-xilinx-distro/distro-builder-common/kas-config-fragments to: /opt/github_runner_yocto/_work/distro-template/distro-template/clone-to-dir/test-template-ci-xilinx-distro/main-image
436---
437Setting bitbake environment variables: export BB_ENV_PASSTHROUGH_ADDITIONS=YOCTO_BRANCH; export YOCTO_BRANCH=nanbield;
438---
439Running command(s): just in-container-build-ci-image
440---
441Not in container, running command(s) through: "docker compose" with image=image
442---
443 Network distro-builder-common_default  Creating
444 Network distro-builder-common_default  Created
445~/kas/run-kas shell "main-image/image.yml:main-image/build_ci.yml" -c "bitbake -c cleansstate virtual/bootloader virtual/kernel"
4462024-02-26 23:44:33 - INFO     - run-kas 4.2 started
4472024-02-26 23:44:33 - INFO     - /app/main-image$ git rev-parse --show-toplevel
4482024-02-26 23:44:33 - INFO     - /app/main-image$ git rev-parse --show-toplevel
4492024-02-26 23:44:33 - INFO     - /app/main-image$ git rev-parse --show-toplevel
4502024-02-26 23:44:33 - INFO     - /app/yocto$ git clone -q https://git.yoctoproject.org/poky /app/yocto/poky/
4512024-02-26 23:44:33 - INFO     - /app/yocto$ git clone -q https://github.com/openembedded/meta-openembedded /app/yocto/layers/meta-openembedded
4522024-02-26 23:44:33 - INFO     - /app/yocto$ git clone -q git@github.com:luftkode/meta-airborne.git /app/yocto/layers/meta-airborne
4532024-02-26 23:44:33 - INFO     - /app/yocto$ git clone -q git@github.com:luftkode/meta-skytem-xilinx.git /app/yocto/layers/meta-skytem-xilinx
4542024-02-26 23:44:33 - INFO     - /app/yocto$ git clone -q https://github.com/Xilinx/meta-xilinx /app/yocto/layers/meta-xilinx
4552024-02-26 23:44:33 - INFO     - /app/yocto$ git clone -q https://github.com/Xilinx/meta-xilinx-tools /app/yocto/layers/meta-xilinx-tools
4562024-02-26 23:44:33 - INFO     - /app/yocto$ git clone -q https://git.yoctoproject.org/meta-virtualization/ /app/yocto/layers/meta-virtualization
4572024-02-26 23:44:33 - INFO     - /app/yocto$ git clone -q git@github.com:rust-embedded/meta-rust-bin.git /app/yocto/layers/meta-rust-bin
4582024-02-26 23:44:33 - ERROR    - Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
4592024-02-26 23:44:33 - ERROR    - Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
4602024-02-26 23:44:33 - ERROR    - Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
4612024-02-26 23:44:34 - INFO     - Repository meta-virtualization cloned
4622024-02-26 23:44:34 - INFO     - /app/yocto/layers/meta-virtualization$ git remote set-url origin https://git.yoctoproject.org/meta-virtualization/
4632024-02-26 23:44:34 - INFO     - /app/yocto/layers/meta-virtualization$ git cat-file -t ac125d881f34ff356390e19e02964f8980d4ec38
4642024-02-26 23:44:34 - INFO     - Repository meta-virtualization already contains ac125d881f34ff356390e19e02964f8980d4ec38 as commit
4652024-02-26 23:44:34 - INFO     - Repository meta-xilinx-tools cloned
4662024-02-26 23:44:34 - INFO     - /app/yocto/layers/meta-xilinx-tools$ git remote set-url origin https://github.com/Xilinx/meta-xilinx-tools
4672024-02-26 23:44:34 - INFO     - /app/yocto/layers/meta-xilinx-tools$ git cat-file -t 92b449c333e3a991735388f4cc0e38ec97e1f9ad
4682024-02-26 23:44:34 - INFO     - Repository meta-xilinx-tools already contains 92b449c333e3a991735388f4cc0e38ec97e1f9ad as commit
4692024-02-26 23:44:34 - INFO     - Repository meta-xilinx cloned
4702024-02-26 23:44:34 - INFO     - /app/yocto/layers/meta-xilinx$ git remote set-url origin https://github.com/Xilinx/meta-xilinx
4712024-02-26 23:44:35 - INFO     - /app/yocto/layers/meta-xilinx$ git cat-file -t a1c7db00727d02b8cd47d665fee86f75b0f83080
4722024-02-26 23:44:35 - INFO     - Repository meta-xilinx already contains a1c7db00727d02b8cd47d665fee86f75b0f83080 as commit
4732024-02-26 23:44:35 - INFO     - Repository meta-skytem-xilinx cloned
4742024-02-26 23:44:35 - INFO     - /app/yocto/layers/meta-skytem-xilinx$ git remote set-url origin git@github.com:luftkode/meta-skytem-xilinx.git
4752024-02-26 23:44:35 - INFO     - /app/yocto/layers/meta-skytem-xilinx$ git cat-file -t e8cf7aaa8c9d4d72a702fa0577421446aa38b223
4762024-02-26 23:44:35 - INFO     - Repository meta-skytem-xilinx already contains e8cf7aaa8c9d4d72a702fa0577421446aa38b223 as commit
4772024-02-26 23:44:35 - INFO     - Repository meta-rust-bin cloned
4782024-02-26 23:44:35 - INFO     - /app/yocto/layers/meta-rust-bin$ git remote set-url origin git@github.com:rust-embedded/meta-rust-bin.git
4792024-02-26 23:44:35 - INFO     - /app/yocto/layers/meta-rust-bin$ git cat-file -t 019e3b0073510e6f39fac23d9a3c2dd6d793a2fe
4802024-02-26 23:44:35 - INFO     - Repository meta-rust-bin already contains 019e3b0073510e6f39fac23d9a3c2dd6d793a2fe as commit
4812024-02-26 23:44:37 - INFO     - Repository meta-airborne cloned
4822024-02-26 23:44:37 - INFO     - /app/yocto/layers/meta-airborne$ git remote set-url origin git@github.com:luftkode/meta-airborne.git
4832024-02-26 23:44:37 - INFO     - /app/yocto/layers/meta-airborne$ git cat-file -t fa6e5f001067ffe6f19e038a8a87cc06d409cafa
4842024-02-26 23:44:37 - INFO     - Repository meta-airborne already contains fa6e5f001067ffe6f19e038a8a87cc06d409cafa as commit
4852024-02-26 23:44:38 - INFO     - Repository meta-openembedded cloned
4862024-02-26 23:44:38 - INFO     - /app/yocto/layers/meta-openembedded$ git remote set-url origin https://github.com/openembedded/meta-openembedded
4872024-02-26 23:44:38 - INFO     - /app/yocto/layers/meta-openembedded$ git cat-file -t da9063bdfbe130f424ba487f167da68e0ce90e7d
4882024-02-26 23:44:38 - INFO     - Repository meta-openembedded already contains da9063bdfbe130f424ba487f167da68e0ce90e7d as commit
4892024-02-26 23:44:49 - INFO     - Repository poky cloned
4902024-02-26 23:44:49 - INFO     - /app/yocto/poky/$ git remote set-url origin https://git.yoctoproject.org/poky
4912024-02-26 23:44:49 - INFO     - /app/yocto/poky/$ git cat-file -t 1a5c00f00c14cee3ba5d39c8c8db7a9738469eab
4922024-02-26 23:44:49 - INFO     - Repository poky already contains 1a5c00f00c14cee3ba5d39c8c8db7a9738469eab as commit
4932024-02-26 23:44:49 - INFO     - /app/yocto/poky/$ git status -s
4942024-02-26 23:44:49 - INFO     - /app/yocto/poky/$ git checkout -q 1a5c00f00c14cee3ba5d39c8c8db7a9738469eab
4952024-02-26 23:44:49 - INFO     - /app/yocto/layers/meta-openembedded$ git status -s
4962024-02-26 23:44:49 - INFO     - /app/yocto/layers/meta-openembedded$ git checkout -q da9063bdfbe130f424ba487f167da68e0ce90e7d
4972024-02-26 23:44:49 - INFO     - /app/yocto/layers/meta-airborne$ git status -s
4982024-02-26 23:44:49 - INFO     - /app/yocto/layers/meta-airborne$ git checkout -q fa6e5f001067ffe6f19e038a8a87cc06d409cafa
4992024-02-26 23:44:49 - INFO     - /app/yocto/layers/meta-skytem-xilinx$ git status -s
5002024-02-26 23:44:49 - INFO     - /app/yocto/layers/meta-skytem-xilinx$ git checkout -q e8cf7aaa8c9d4d72a702fa0577421446aa38b223
5012024-02-26 23:44:49 - INFO     - /app/yocto/layers/meta-xilinx$ git status -s
5022024-02-26 23:44:50 - INFO     - /app/yocto/layers/meta-xilinx$ git checkout -q a1c7db00727d02b8cd47d665fee86f75b0f83080
5032024-02-26 23:44:50 - INFO     - /app/yocto/layers/meta-xilinx-tools$ git status -s
5042024-02-26 23:44:50 - INFO     - /app/yocto/layers/meta-xilinx-tools$ git checkout -q 92b449c333e3a991735388f4cc0e38ec97e1f9ad
5052024-02-26 23:44:50 - INFO     - /app/yocto/layers/meta-virtualization$ git status -s
5062024-02-26 23:44:50 - INFO     - /app/yocto/layers/meta-virtualization$ git checkout -q ac125d881f34ff356390e19e02964f8980d4ec38
5072024-02-26 23:44:50 - INFO     - /app/yocto/layers/meta-rust-bin$ git status -s
5082024-02-26 23:44:50 - INFO     - /app/yocto/layers/meta-rust-bin$ git checkout -q 019e3b0073510e6f39fac23d9a3c2dd6d793a2fe
5092024-02-26 23:44:50 - INFO     - /app/yocto/poky/$ /tmp/tmpjxb_xapi/get_bb_env /app/yocto/build
5102024-02-26 23:44:50 - INFO     - To start the default build, run: bitbake -c build test-template-ci-xilinx-image package-index
511Loading cache...done.
512Loaded 0 entries from dependency cache.
513Parsing recipes...ERROR: ParseError at /app/yocto/build/../layers/meta-skytem-xilinx/recipes-bundles/zynq-update-bundle/zynq-update-bundle.bb:1: Could not inherit file classes/bundle.bbclass
514ERROR: Parsing halted due to errors, see error messages above
515
516Summary: There were 2 ERROR messages, returning a non-zero exit code.
5172024-02-26 23:46:07 - ERROR    - Shell returned non-zero exit status
5182024-02-26 23:46:07 - ERROR    - Command "/bin/bash -c 'bitbake -c cleansstate virtual/bootloader virtual/kernel'" failed with error 1
519error: Recipe `in-container-build-ci-image` failed on line 30 with exit code 1
520error: Recipe `run-in-docker` failed with exit code 1
521error: Recipe `build-ci-image` failed with exit code 1
522##[error]Process completed with exit code 1.
523##[group]Run cargo install gh-workflow-parser --profile release-ci && gh-workflow-parser --version
524cargo install gh-workflow-parser --profile release-ci && gh-workflow-parser --version
525failure_log_abs_path=$( gh-workflow-parser locate-failure-log --input-file="yocto_build.log" --kind=yocto )
526failure_log_basename=$( basename "${failure_log_abs_path}" )
527echo "failure_log_abs_path=${failure_log_abs_path}"
528echo "failure_log_basename=${failure_log_basename}"
529echo "YOCTO_FAILED_LOG_PATH=${failure_log_abs_path}" >> $GITHUB_ENV
530echo "YOCTO_FAILED_LOG_BASENAME=${failure_log_basename}" >> $GITHUB_ENV
531shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
532env:
533  REGISTRY: ghcr.io
534  CARGO_TERM_COLOR: always
535  SSH_AUTH_SOCK: /tmp/ssh-XXXXXXooAvJr/agent.4134531
536  CLONE_TO_DIR: clone-to-dir
537  YOCTO_BUILD_LOG: yocto_build.log
538##[endgroup]
539    Updating crates.io index
540     Ignored package `gh-workflow-parser v0.5.3` is already installed, use --force to override
541gh-workflow-parser 0.5.3
542INFO Locating failure log for kind: Yocto
543INFO Reading log file: "yocto_build.log"
544ERROR No log file line found
545##[error]Process completed with exit code 1.
546##[group]Run actions/upload-artifact@v4
547with:
548  retention-days: 7
549  if-no-files-found: warn
550  compression-level: 6
551  overwrite: false
552env:
553  REGISTRY: ghcr.io
554  CARGO_TERM_COLOR: always
555  SSH_AUTH_SOCK: /tmp/ssh-XXXXXXooAvJr/agent.4134531
556  CLONE_TO_DIR: clone-to-dir
557  YOCTO_BUILD_LOG: yocto_build.log
558##[endgroup]
559##[error]Input required and not supplied: path
560```"#;
561}