Skip to content

Commit

Permalink
Add ability to filter images by tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Itai Gendler authored and Itai Gendler committed Jan 16, 2018
1 parent e81fd25 commit ec772c7
Show file tree
Hide file tree
Showing 15 changed files with 95 additions and 31 deletions.
10 changes: 5 additions & 5 deletions docs-template/content/contexts/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
title = "Contexts"
+++

### [Update a context](update-a-context)
`codefresh patch context`

Apply changes to a context

### [Create a context](create-a-context)
`codefresh create context [type] [name]`

Create a context

### [Update a context](update-a-context)
`codefresh patch context`

Apply changes to a context

### [Delete a context](delete-a-context)
`codefresh delete context [name]`

Expand Down
1 change: 1 addition & 0 deletions docs-template/content/images/Get a single image.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Option | Default | Description
--limit | 25 | Limit amount of returned results
--all | | Return images from all possible registries (by default only r.cfcr.io images will be returned)
--label | | Filter by a list of annotated labels
--tag | | Filter by a list of tags
--sha | | Filter by specific commit sha
--image-name | | Filter by specific image name
--branch | | Filter by specific branch
Expand Down
25 changes: 25 additions & 0 deletions docs/authentication/create-authentication-context/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,31 @@
<span>Contexts</span><i class="fa fa-angle-right fa-lg category-icon"></i>
</a>
<ul>
<li data-nav-id="/contexts/create-a-context/" class="dd-item">
<a href="/contexts/create-a-context/">
<span>Create a context</span>
</a>
</li>
<li data-nav-id="/contexts/delete-a-context/" class="dd-item">
<a href="/contexts/delete-a-context/">
<span>Delete a context</span>
</a>
</li>
<li data-nav-id="/contexts/get-a-single-context/" class="dd-item">
<a href="/contexts/get-a-single-context/">
<span>Get a single context</span>
</a>
</li>
<li data-nav-id="/contexts/replace-a-context/" class="dd-item">
<a href="/contexts/replace-a-context/">
<span>Replace a context</span>
</a>
</li>
<li data-nav-id="/contexts/update-a-context/" class="dd-item">
<a href="/contexts/update-a-context/">
<span>Update a context</span>
</a>
</li>
</ul>
</li>
<li data-nav-id="/environments/" class="dd-item">
Expand Down
10 changes: 10 additions & 0 deletions docs/builds/get-a-single-build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,16 @@
<span>Environments</span><i class="fa fa-angle-right fa-lg category-icon"></i>
</a>
<ul>
<li data-nav-id="/environments/delete-an-environment/" class="dd-item">
<a href="/environments/delete-an-environment/">
<span>Delete an environment</span>
</a>
</li>
<li data-nav-id="/environments/get-a-single-composition/" class="dd-item">
<a href="/environments/get-a-single-composition/">
<span>Get a single composition</span>
</a>
</li>
</ul>
</li>
<li data-nav-id="/images/" class="dd-item">
Expand Down
14 changes: 7 additions & 7 deletions docs/contexts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@
<ul>
<li>
<ul>
<li><a href="#update-a-context-update-a-context"><a href="update-a-context">Update a context</a></a></li>
<li><a href="#create-a-context-create-a-context"><a href="create-a-context">Create a context</a></a></li>
<li><a href="#update-a-context-update-a-context"><a href="update-a-context">Update a context</a></a></li>
<li><a href="#delete-a-context-delete-a-context"><a href="delete-a-context">Delete a context</a></a></li>
<li><a href="#get-a-single-context-get-a-single-context"><a href="get-a-single-context">Get a single context</a></a></li>
<li><a href="#replace-a-context-replace-a-context"><a href="replace-a-context">Replace a context</a></a></li>
Expand Down Expand Up @@ -381,18 +381,18 @@ <h1>Contexts</h1>



<h3 id="update-a-context-update-a-context"><a href="update-a-context">Update a context</a></h3>

<p><code>codefresh patch context</code></p>

<p>Apply changes to a context</p>

<h3 id="create-a-context-create-a-context"><a href="create-a-context">Create a context</a></h3>

<p><code>codefresh create context [type] [name]</code></p>

<p>Create a context</p>

<h3 id="update-a-context-update-a-context"><a href="update-a-context">Update a context</a></h3>

<p><code>codefresh patch context</code></p>

<p>Apply changes to a context</p>

<h3 id="delete-a-context-delete-a-context"><a href="delete-a-context">Delete a context</a></h3>

<p><code>codefresh delete context [name]</code></p>
Expand Down
6 changes: 6 additions & 0 deletions docs/images/get-a-single-image/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,12 @@ <h3 id="options">Options</h3>
<td>Filter by a list of annotated labels</td>
</tr>

<tr>
<td>&ndash;tag</td>
<td></td>
<td>Filter by a list of tags</td>
</tr>

<tr>
<td>&ndash;sha</td>
<td></td>
Expand Down
4 changes: 2 additions & 2 deletions docs/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"title": "Contexts",
"tags": [],
"description": "",
"content": " Update a context codefresh patch context\nApply changes to a context\nCreate a context codefresh create context [type] [name]\nCreate a context\nDelete a context codefresh delete context [name]\nDelete a context\nGet a single context codefresh get contexts [name]\nGet a specific or an array of contexts\nReplace a context codefresh replace context\nReplace a context\n"
"content": " Create a context codefresh create context [type] [name]\nCreate a context\nUpdate a context codefresh patch context\nApply changes to a context\nDelete a context codefresh delete context [name]\nDelete a context\nGet a single context codefresh get contexts [name]\nGet a specific or an array of contexts\nReplace a context codefresh replace context\nReplace a context\n"
},
{
"uri": "http://cli.codefresh.io/compositions/create-a-composition/",
Expand Down Expand Up @@ -200,7 +200,7 @@
"title": "Get a single image",
"tags": [],
"description": "",
"content": " Command codefresh get images [id]\nGet a specific or an array of images\nPositionals Option Default Description id image id Options Option Default Description \u0026ndash;limit 25 Limit amount of returned results \u0026ndash;all Return images from all possible registries (by default only r.cfcr.io images will be returned) \u0026ndash;label Filter by a list of annotated labels \u0026ndash;sha Filter by specific commit sha \u0026ndash;image-name Filter by specific image name \u0026ndash;branch Filter by specific branch \u0026ndash;page 1 Paginated page "
"content": " Command codefresh get images [id]\nGet a specific or an array of images\nPositionals Option Default Description id image id Options Option Default Description \u0026ndash;limit 25 Limit amount of returned results \u0026ndash;all Return images from all possible registries (by default only r.cfcr.io images will be returned) \u0026ndash;label Filter by a list of annotated labels \u0026ndash;tag Filter by a list of tags \u0026ndash;sha Filter by specific commit sha \u0026ndash;image-name Filter by specific image name \u0026ndash;branch Filter by specific branch \u0026ndash;page 1 Paginated page "
},
{
"uri": "http://cli.codefresh.io/pipelines/get-a-single-pipeline/",
Expand Down
2 changes: 1 addition & 1 deletion docs/index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ Positionals Option Default Description name context name Options O
<guid>http://cli.codefresh.io/images/get-a-single-image/</guid>
<description> Command codefresh get images [id]
Get a specific or an array of images
Positionals Option Default Description id image id Options Option Default Description &amp;ndash;limit 25 Limit amount of returned results &amp;ndash;all Return images from all possible registries (by default only r.cfcr.io images will be returned) &amp;ndash;label Filter by a list of annotated labels &amp;ndash;sha Filter by specific commit sha &amp;ndash;image-name Filter by specific image name &amp;ndash;branch Filter by specific branch &amp;ndash;page 1 Paginated page </description>
Positionals Option Default Description id image id Options Option Default Description &amp;ndash;limit 25 Limit amount of returned results &amp;ndash;all Return images from all possible registries (by default only r.cfcr.io images will be returned) &amp;ndash;label Filter by a list of annotated labels &amp;ndash;tag Filter by a list of tags &amp;ndash;sha Filter by specific commit sha &amp;ndash;image-name Filter by specific image name &amp;ndash;branch Filter by specific branch &amp;ndash;page 1 Paginated page </description>
</item>

<item>
Expand Down
15 changes: 15 additions & 0 deletions docs/predefined-pipelines/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,21 @@
<span>Pipelines</span><i class="fa fa-angle-right fa-lg category-icon"></i>
</a>
<ul>
<li data-nav-id="/pipelines/execute-a-pipeline/" class="dd-item">
<a href="/pipelines/execute-a-pipeline/">
<span>Execute a pipeline</span>
</a>
</li>
<li data-nav-id="/pipelines/get-a-single-pipeline/" class="dd-item">
<a href="/pipelines/get-a-single-pipeline/">
<span>Get a single pipeline</span>
</a>
</li>
<li data-nav-id="/pipelines/update-a-single-pipeline/" class="dd-item">
<a href="/pipelines/update-a-single-pipeline/">
<span>Update a single pipeline</span>
</a>
</li>
</ul>
</li>
<li data-nav-id="/predefined-pipelines/" class="dd-item parent active">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,19 +221,19 @@
<span>Images</span><i class="fa fa-angle-right fa-lg category-icon"></i>
</a>
<ul>
<li data-nav-id="/images/annotate-an-image/" class="dd-item">
<a href="/images/annotate-an-image/">
<span>Annotate an image</span>
<li data-nav-id="/predefined-pipelines/delete-a-helm-release/" class="dd-item">
<a href="/predefined-pipelines/delete-a-helm-release/">
<span>Delete a helm release</span>
</a>
</li>
<li data-nav-id="/images/get-a-single-image/" class="dd-item">
<a href="/images/get-a-single-image/">
<span>Get a single image</span>
<li data-nav-id="/predefined-pipelines/install-or-upgrade-a-helm-chart/" class="dd-item active">
<a href="/predefined-pipelines/install-or-upgrade-a-helm-chart/">
<span>Install or upgrade a Helm chart</span>
</a>
</li>
<li data-nav-id="/images/tag-an-image/" class="dd-item">
<a href="/images/tag-an-image/">
<span>Tag an image</span>
<li data-nav-id="/predefined-pipelines/test-a-helm-release/" class="dd-item">
<a href="/predefined-pipelines/test-a-helm-release/">
<span>Test a helm release</span>
</a>
</li>
</ul>
Expand Down
8 changes: 3 additions & 5 deletions examples/pipeline2-git.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: new-pipeline
account: 59d33c4e9f75220a3710b2ee
name: new-pipeline-git
metadata:
labels:
repo: github:ArikMaor/ping-server
Expand All @@ -9,7 +8,7 @@ spec:
repo: ArikMaor/ping-server
events: [push, pullrequest]
branchRegex: '.'
contexts: ['lala']
contexts: []
variables:
- key: PORT
value: 3000
Expand All @@ -19,6 +18,5 @@ spec:
encrypted: true
source:
location: git
repo: ArikMaor/ping-server
repo: codefresh-io/cli
path: codefresh.yml

2 changes: 1 addition & 1 deletion examples/pipeline2-url.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: new-pipeline-url
#account: 59d33c4e9f75220a3710b2ee
metadata:
labels:
repo: github:ArikMaor/ping-server
repo: github:codefresh-io/cli
spec:
triggers:
- type: scm
Expand Down
8 changes: 8 additions & 0 deletions lib/interface/cli/commands/image/get.cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ const command = new Command({
alias: 'l',
default: [],
})
.option('tag', {
describe: 'Filter by a list of tags',
alias: 't',
type: Array,
default: [],
})
.option('sha', {
describe: 'Filter by specific commit sha',
alias: 's',
Expand All @@ -58,6 +64,7 @@ const command = new Command({
handler: async (argv) => {
const imageId = argv.id;
const labels = prepareKeyValueFromCLIEnvOption(argv.label);
const tags = argv.tag;
const sha = argv.sha;
const limit = argv.limit;
const type = argv.type;
Expand All @@ -80,6 +87,7 @@ const command = new Command({
} else {
images = await image.getAll({
labels,
tags,
sha,
limit,
filterRegistries,
Expand Down
1 change: 1 addition & 0 deletions lib/logic/api/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const getAll = async (options) => {
limit: options.limit,
offset: options.offset,
metadata: options.labels,
tag: options.tags,
type: options.type,
branch: options.branch,
imageDisplayNameRegex: options.imageName,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codefresh",
"version": "0.7.5",
"version": "0.7.6",
"description": "Codefresh command line utility",
"main": "index.js",
"preferGlobal": true,
Expand Down

0 comments on commit ec772c7

Please sign in to comment.