Skip to content

Commit e454cf9

Browse files
committed
Add skip repo ability in push docker artifacts
1 parent 8f7467e commit e454cf9

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

.github/workflows/build-docker-artifacts-config.schema.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
"properties": {
1515
"directory": {
1616
"type": "string",
17-
"description": "Directory of the flavor containing the components to build"
17+
"description": "Directory of the build containing the components"
1818
},
1919
"skip": {
2020
"type": "boolean",
2121
"default": false,
22-
"description": "Skip building the flavor"
22+
"description": "Skip building the build"
2323
},
2424
"components": {
2525
"type": "array",
@@ -29,7 +29,7 @@
2929
"properties": {
3030
"directory": {
3131
"type": "string",
32-
"description": "Directory of the component to build, relative to the flavor directory"
32+
"description": "Directory of the component to build, relative to the build directory"
3333
},
3434
"ecr_repository": {
3535
"type": "string",
@@ -72,6 +72,11 @@
7272
"type": "string",
7373
"description": "Registry URL at customer"
7474
},
75+
"skip": {
76+
"type": "boolean",
77+
"default": false,
78+
"description": "Skip pushing the images"
79+
},
7580
"repositories": {
7681
"type": "array",
7782
"items": {
@@ -93,6 +98,11 @@
9398
"target_image_tag": {
9499
"type": "string",
95100
"description": "Tag of the target image. If omitted, uses the tag of the current build."
101+
},
102+
"skip": {
103+
"type": "boolean",
104+
"default": false,
105+
"description": "Skip pushing this image"
96106
}
97107
},
98108
"required": ["source_repository", "target_repository"]

.github/workflows/build-docker-artifacts-push.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,15 @@ jobs:
6464
script: |
6565
const customer = JSON.parse(process.env.CUSTOMER_JSON);
6666
67+
const filteredRepositories = customer.repositories.filter(repo => !repo.skip);
68+
6769
// Comma separated list of source images, incl. registry, repository and tag
68-
const sourceImages = customer.repositories.map(repo => `${process.env.SOURCE_ECR_REGISTRY}/${repo.source_repository}:${repo.source_image_tag || process.env.IMAGE_TAG}`).join(',');
69-
const destinationImages = customer.repositories.map(repo => `${customer.registry}/${repo.target_repository}:${repo.target_image_tag || process.env.IMAGE_TAG}`).join(',');
70+
const sourceImages = filteredRepositories.map(repo => `${process.env.SOURCE_ECR_REGISTRY}/${repo.source_repository}:${repo.source_image_tag || process.env.IMAGE_TAG}`).join(',');
71+
const destinationImages = filteredRepositories.map(repo => `${customer.registry}/${repo.target_repository}:${repo.target_image_tag || process.env.IMAGE_TAG}`).join(',');
7072
7173
const result = {
7274
customer,
75+
skip: !!customer.skip,
7376
source_images: sourceImages,
7477
destination_images: destinationImages
7578
};
@@ -82,18 +85,21 @@ jobs:
8285
IMAGE_TAG: ${{ inputs.image_tag }}
8386

8487
- name: Get dv image aws config
88+
if: ${{ fromJson(steps.get-customer.outputs.result).skip != true }}
8589
id: get-dv-aws-image-config
8690
uses: ./.github/actions/get-aws-config
8791
with:
8892
aws_config: ${{ secrets.DV_AWS_ECR_SECRETS }}
8993

9094
- name: Get image aws config
95+
if: ${{ fromJson(steps.get-customer.outputs.result).skip != true }}
9196
id: get-aws-image-config
9297
uses: ./.github/actions/get-aws-config
9398
with:
9499
aws_config: ${{ secrets[fromJson(steps.get-customer.outputs.result).customer.secret_key] }}
95100

96101
- name: Push images
102+
if: ${{ fromJson(steps.get-customer.outputs.result).skip != true }}
97103
id: pull-push-image
98104
uses: ./.github/actions/pull-push-image
99105
with:

.github/workflows/build-docker-artifacts-trigger-push.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ jobs:
8282
const result = customers.map((c) => ({
8383
repository: process.env.REPOSITORY,
8484
customer: c,
85+
skip: !!config.push[c].skip,
8586
customer_json: JSON.stringify(config.push[c]),
8687
image_tag: imageTagBranchName,
8788
}));
@@ -101,6 +102,7 @@ jobs:
101102
runs-on: ${{ inputs.runs_on }}
102103
steps:
103104
- name: Trigger push docker artifacts to ${{ matrix.customer.customer }}
105+
if: ${{ matrix.customer.skip != true }}
104106
uses: datavisyn/github-action-trigger-workflow@v1
105107
with:
106108
owner: "datavisyn"

0 commit comments

Comments
 (0)