GitLab API未在容器注册表中列出所有图像存储库

时间:2020-10-20 11:10:12

标签: gitlab gitlab-ci

一段时间以来,我一直在使用CI管道将Docker映像推送到我的GitLab容器注册表中,并且我一直在使用此命令列出注册表中的所有存储库(20个存储库):

curl --header "PRIVATE-TOKEN:  $GITLAB_TOKEN" "$CI_SERVER_PROTOCOL://$CI_SERVER_HOST/api/v4/projects/$PROJECT_ID/registry/repositories"

我使用CI创建了5个新的存储库,并且可以在GitLab的界面中看到所有存储库(25个存储库),但是该命令仅返回20个存储库。

这可能是什么原因?

1 个答案:

答案 0 :(得分:0)

20是使用Gitlab API每页列出的默认项目数。

您可以更改项目import React, { useState, useEffect } from "react"; import { Container} from 'react-bootstrap' import Layout from '../components/layout' import { Helmet } from 'react-helmet' import styles from './layout.module.css' import Form from 'react-bootstrap/Form' import Button from 'react-bootstrap/Button' import Card from 'react-bootstrap/Card' class App extends React.Component { constructor(props) { super(props); this.state = { contents: [] } } state = { hasErrors: false, content: {} }; componentDidMount() { fetch("http://localhost:3000/api/feed") .then(res => res.json()) .then(res => this.setState({ contents: res })) .catch(() => this.setState({ hasErrors: true })); } render() { const { contents } = this.state return ( <> <Layout> <Helmet> <title>Feed</title> </Helmet> <Container> <br /><br /><br /> {/* <h5>Start typing...</h5> */} <form id="feed-form" onSubmit={this.handleSubmit.bind(this)} method="POST"> <Form.Group> <Form.Control as="textarea" rows="10" name="feed" style={{ backgroundColor: 'gray'}} value={this.state.message} onChange={this.onMessageChange.bind(this)} /> <Form.Text className="text-muted"> Post visible after page refresh. </Form.Text> </Form.Group> <Button type="submit" style={{ backgroundColor: 'gray', border: 'grey' }}> Submit </Button> </form><br /> {contents.map((item, index) => <> <Card border="dark" text="light"> <Card.Body> {item.content}<br /><br /> <Card.Text className="text-right"> <small className="text-muted">{formatDate(item.date)}</small> </Card.Text> </Card.Body> </Card><br/></> )} <div className={styles.backToHome}> <a href="/" className="link"> ← Back to home </a> </div> </Container> </Layout> </> ); } onMessageChange(event) { this.setState({content: event.target.value}) } handleSubmit(e) { e.preventDefault(); fetch('http://localhost:3000/api/feed', { method: "POST", body: JSON.stringify(this.state), headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }, }).then( (response) => (response.json()) ).then((response)=> { if (response.status === 'success') { alert("Message Sent."); this.resetForm() } else if(response.status === 'fail') { alert("Message failed to send.") } }) } } function formatDate( string ) { var options = { year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' }; return new Date( string ).toLocaleDateString([], options); } export default App; 的数量(但最大为100),也可以使用分页链接标题对结果进行迭代。可以在documentation中找到详细的说明。

相关问题