Skip to content

Commit 8ac16bb

Browse files
committed
Add mirror env var options and fix required parameters to templates
The Python, Ruby, Perl, NodeJS and PHP images have environment variables that allow custom mirror repository URLs to use during the build process to fetch or download required packages instead of the default central repositories. For Python: PIP_INDEX_URL to use custom PyPi mirror link For Perl: CPAN_MIRROR to use custom CPAN mirror link For NodeJS: NPM_MIRROR to use custom NPM mirror link For Ruby: RUBYGEM_MIRROR to use custom RubyGems mirror link For PHP: COMPOSER_MIRROR to use custom Composer/Packagist mirror link This PR modifies templates associated those images to add the parameters to allow users to inject custom mirror links if needed. There are several parameters that are required during the build process. However, those are not marked as required which will cause failure if users leave them blank. Those parameters need to be explicitly marked as required to avoid confusion and unexpected failure. Signed-off-by: Vu Dinh <[email protected]>
1 parent ae96a13 commit 8ac16bb

File tree

6 files changed

+204
-10
lines changed

6 files changed

+204
-10
lines changed

examples/quickstarts/cakephp-mysql.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,13 @@
8484
"kind": "ImageStreamTag",
8585
"namespace": "${NAMESPACE}",
8686
"name": "php:5.6"
87-
}
87+
},
88+
"env": [
89+
{
90+
"name": "COMPOSER_MIRROR",
91+
"value": "${COMPOSER_MIRROR}"
92+
}
93+
]
8894
}
8995
},
9096
"output": {
@@ -376,24 +382,28 @@
376382
"name": "NAMESPACE",
377383
"displayName": "Namespace",
378384
"description": "The OpenShift Namespace where the ImageStream resides.",
385+
"required": true,
379386
"value": "openshift"
380387
},
381388
{
382389
"name": "MEMORY_LIMIT",
383390
"displayName": "Memory Limit",
384391
"description": "Maximum amount of memory the CakePHP container can use.",
392+
"required": true,
385393
"value": "512Mi"
386394
},
387395
{
388396
"name": "MEMORY_MYSQL_LIMIT",
389397
"displayName": "Memory Limit (MySQL)",
390398
"description": "Maximum amount of memory the MySQL container can use.",
399+
"required": true,
391400
"value": "512Mi"
392401
},
393402
{
394403
"name": "SOURCE_REPOSITORY_URL",
395404
"displayName": "Git Repository URL",
396405
"description": "The URL of the repository with your application source code.",
406+
"required": true,
397407
"value": "https://github.com/openshift/cakephp-ex.git"
398408
},
399409
{
@@ -422,22 +432,26 @@
422432
{
423433
"name": "DATABASE_SERVICE_NAME",
424434
"displayName": "Database Service Name",
435+
"required": true,
425436
"value": "mysql"
426437
},
427438
{
428439
"name": "DATABASE_ENGINE",
429440
"displayName": "Database Engine",
430441
"description": "Database engine: postgresql, mysql or sqlite (default).",
442+
"required": true,
431443
"value": "mysql"
432444
},
433445
{
434446
"name": "DATABASE_NAME",
435447
"displayName": "Database Name",
448+
"required": true,
436449
"value": "default"
437450
},
438451
{
439452
"name": "DATABASE_USER",
440453
"displayName": "Database User",
454+
"required": true,
441455
"value": "cakephp"
442456
},
443457
{
@@ -472,6 +486,12 @@
472486
"displayName": "OPcache Revalidation Frequency",
473487
"description": "How often to check script timestamps for updates, in seconds. 0 will result in OPcache checking for updates on every request.",
474488
"value": "2"
489+
},
490+
{
491+
"name": "COMPOSER_MIRROR",
492+
"displayName": "Custom Composer Mirror URL",
493+
"description": "The custom Composer mirror URL",
494+
"value": ""
475495
}
476496
]
477497
}

examples/quickstarts/dancer-mysql.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,13 @@
8484
"kind": "ImageStreamTag",
8585
"namespace": "${NAMESPACE}",
8686
"name": "perl:5.20"
87-
}
87+
},
88+
"env": [
89+
{
90+
"name": "CPAN_MIRROR",
91+
"value": "${CPAN_MIRROR}"
92+
}
93+
]
8894
}
8995
},
9096
"output": {
@@ -350,24 +356,28 @@
350356
"name": "NAMESPACE",
351357
"displayName": "Namespace",
352358
"description": "The OpenShift Namespace where the ImageStream resides.",
359+
"required": true,
353360
"value": "openshift"
354361
},
355362
{
356363
"name": "MEMORY_LIMIT",
357364
"displayName": "Memory Limit",
358365
"description": "Maximum amount of memory the Perl Dancer container can use.",
366+
"required": true,
359367
"value": "512Mi"
360368
},
361369
{
362370
"name": "MEMORY_MYSQL_LIMIT",
363371
"displayName": "Memory Limit (MySQL)",
364372
"description": "Maximum amount of memory the MySQL container can use.",
373+
"required": true,
365374
"value": "512Mi"
366375
},
367376
{
368377
"name": "SOURCE_REPOSITORY_URL",
369378
"displayName": "Git Repository URL",
370379
"description": "The URL of the repository with your application source code.",
380+
"required": true,
371381
"value": "https://github.com/openshift/dancer-ex.git"
372382
},
373383
{
@@ -408,6 +418,7 @@
408418
{
409419
"name": "DATABASE_SERVICE_NAME",
410420
"displayName": "Database Service Name",
421+
"required": true,
411422
"value": "database"
412423
},
413424
{
@@ -425,6 +436,7 @@
425436
{
426437
"name": "DATABASE_NAME",
427438
"displayName": "Database Name",
439+
"required": true,
428440
"value": "sampledb"
429441
},
430442
{
@@ -439,6 +451,12 @@
439451
"description": "Your secret key for verifying the integrity of signed cookies.",
440452
"generate": "expression",
441453
"from": "[a-z0-9]{127}"
454+
},
455+
{
456+
"name": "CPAN_MIRROR",
457+
"displayName": "Custom CPAN Mirror URL",
458+
"description": "The custom CPAN mirror URL",
459+
"value": ""
442460
}
443461
]
444462
}

examples/quickstarts/django-postgresql.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,13 @@
8484
"kind": "ImageStreamTag",
8585
"namespace": "${NAMESPACE}",
8686
"name": "python:3.4"
87-
}
87+
},
88+
"env": [
89+
{
90+
"name": "PIP_INDEX_URL",
91+
"value": "${PIP_INDEX_URL}"
92+
}
93+
]
8894
}
8995
},
9096
"output": {
@@ -359,24 +365,28 @@
359365
{
360366
"name": "NAMESPACE",
361367
"displayName": "Namespace",
368+
"required": true,
362369
"description": "The OpenShift Namespace where the ImageStream resides.",
363370
"value": "openshift"
364371
},
365372
{
366373
"name": "MEMORY_LIMIT",
367374
"displayName": "Memory Limit",
375+
"required": true,
368376
"description": "Maximum amount of memory the Django container can use.",
369377
"value": "512Mi"
370378
},
371379
{
372380
"name": "MEMORY_POSTGRESQL_LIMIT",
373381
"displayName": "Memory Limit (PostgreSQL)",
382+
"required": true,
374383
"description": "Maximum amount of memory the PostgreSQL container can use.",
375384
"value": "512Mi"
376385
},
377386
{
378387
"name": "SOURCE_REPOSITORY_URL",
379388
"displayName": "Git Repository URL",
389+
"required": true,
380390
"description": "The URL of the repository with your application source code.",
381391
"value": "https://github.com/openshift/django-ex.git"
382392
},
@@ -406,22 +416,26 @@
406416
{
407417
"name": "DATABASE_SERVICE_NAME",
408418
"displayName": "Database Service Name",
419+
"required": true,
409420
"value": "postgresql"
410421
},
411422
{
412423
"name": "DATABASE_ENGINE",
413424
"displayName": "Database Engine",
425+
"required": true,
414426
"description": "Database engine: postgresql, mysql or sqlite (default).",
415427
"value": "postgresql"
416428
},
417429
{
418430
"name": "DATABASE_NAME",
419431
"displayName": "Database Name",
432+
"required": true,
420433
"value": "default"
421434
},
422435
{
423436
"name": "DATABASE_USER",
424437
"displayName": "Database Username",
438+
"required": true,
425439
"value": "django"
426440
},
427441
{
@@ -441,6 +455,12 @@
441455
"description": "Set this to a long random string.",
442456
"generate": "expression",
443457
"from": "[\\w]{50}"
458+
},
459+
{
460+
"name": "PIP_INDEX_URL",
461+
"displayName": "Custom PyPi Index URL",
462+
"description": "The custom PyPi index URL",
463+
"value": ""
444464
}
445465
]
446466
}

examples/quickstarts/nodejs-mongodb.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,13 @@
8484
"kind": "ImageStreamTag",
8585
"namespace": "${NAMESPACE}",
8686
"name": "nodejs:0.10"
87-
}
87+
},
88+
"env": [
89+
{
90+
"name": "NPM_MIRROR",
91+
"value": "${NPM_MIRROR}"
92+
}
93+
]
8894
}
8995
},
9096
"output": {
@@ -364,24 +370,28 @@
364370
"name": "NAMESPACE",
365371
"displayName": "Namespace",
366372
"description": "The OpenShift Namespace where the ImageStream resides.",
373+
"required": true,
367374
"value": "openshift"
368375
},
369376
{
370377
"name": "MEMORY_LIMIT",
371378
"displayName": "Memory Limit",
372379
"description": "Maximum amount of memory the Node.js container can use.",
380+
"required": true,
373381
"value": "512Mi"
374382
},
375383
{
376384
"name": "MEMORY_MONGODB_LIMIT",
377385
"displayName": "Memory Limit (MongoDB)",
378386
"description": "Maximum amount of memory the MongoDB container can use.",
387+
"required": true,
379388
"value": "512Mi"
380389
},
381390
{
382391
"name": "SOURCE_REPOSITORY_URL",
383392
"displayName": "Git Repository URL",
384393
"description": "The URL of the repository with your application source code.",
394+
"required": true,
385395
"value": "https://github.com/openshift/nodejs-ex.git"
386396
},
387397
{
@@ -417,6 +427,7 @@
417427
{
418428
"name": "DATABASE_SERVICE_NAME",
419429
"displayName": "Database Service Name",
430+
"required": true,
420431
"value": "mongodb"
421432
},
422433
{
@@ -436,6 +447,7 @@
436447
{
437448
"name": "DATABASE_NAME",
438449
"displayName": "Database Name",
450+
"required": true,
439451
"value": "sampledb"
440452
},
441453
{
@@ -444,6 +456,12 @@
444456
"description": "Password for the database admin user.",
445457
"generate": "expression",
446458
"from": "[a-zA-Z0-9]{16}"
459+
},
460+
{
461+
"name": "NPM_MIRROR",
462+
"displayName": "Custom NPM Mirror URL",
463+
"description": "The custom NPM mirror URL",
464+
"value": ""
447465
}
448466
]
449467
}

0 commit comments

Comments
 (0)