Circle Ci 2.0 artifacts url

时间:2017-10-23 01:25:54

标签: circleci artifacts

使用以下网址

可以访问Circle Ci 2.0工件

https://{BUILD_NUMBER}-{UNKNOWN_NUMBER}-gh.circle-artifacts.com/0

CI构建号码后的数字代表什么。

2 个答案:

答案 0 :(得分:1)

如果像我一样,您正在寻找一种以编程方式引用CircleCI(2.0)工件的方法,则以下网址结构对我有用:

https://circleci.com/api/v1.1/project/:vcs-type/:username/:project/:build_num/artifacts/0/:path-to-artifact?circle-token=:token&branch=:branch

例如:

https://circleci.com/api/v1.1/project/github/circleci/circleci-docs/latest/artifacts/0/run-results/build-results.txt?branch=realitycheck&filter=successful

在circleci-docs项目的realismcheck分支的最新成功构建中解决了build-results.txt工件。

可以通过检查CircleCI工件目录结构来完成:path-to-artifact的构建:

enter image description here

从上方看,:path-to-artifact0/run-results/build-results.txt

参考:

答案 1 :(得分:0)

{UNKNOWN_NUMBER}代表存储库的Github ID。

如果您运行以下代码段,则可以获取github rest API

提供的任何组织和存储库所需的ID。

function query_gh(){
  var org = document.getElementById("org").value;
  var repo = document.getElementById("repo").value;

  async function query(org, repo) {
    const response = await fetch("https://api.github.com/orgs/"+org+"/repos");
    const outJson = await response.json();

    for (var i = 0; i < outJson.length; i++){
      var repository = outJson[i];
      if (repository.name == repo) {
        id = repository.id;
        output.innerHTML = org +"/"+ repo + " has ID: " + id;
        return true;
      }
    }
  }
  query(org, repo);
  return true;
}
<!DOCTYPE html>
<html>
<body>

<p>Enter names of the GH organisation and repository</p>
<form onsubmit="query_gh(); return false;">
 <label for="org">Organisation</label>
 <input type="text" id="org" required="">
 <br>
 <label for="repo">Repository</label>
 <input type="text" id="repo" required="">
 <br>
 <button type="submit">Query</button>

</form>

<div id="output">
 <span id="output_text">...</span>
</div>

</body>
</html>