11'use strict' ;
2- import { compress } from '@fakoua/zip-ts' ;
2+
3+ import { tgz } from "jsr:@deno-library/compress" ;
34import { parse , stringify as toYaml } from '@std/yaml' ;
45import { getSemaphore } from '@henrygd/semaphore' ;
56
@@ -13,7 +14,7 @@ const cfRuntimeTypes = {
1314
1415const timestamp = new Date ( ) . getTime ( ) ;
1516const dirPath = `./codefresh-support-${ timestamp } ` ;
16- const supportPackageZip = `./codefresh-support-package-${ timestamp } .zip ` ;
17+ const supportPackageZip = `./codefresh-support-package-${ timestamp } .tar.gz ` ;
1718const numOfProcesses = 5 ;
1819
1920// ##############################
@@ -190,7 +191,7 @@ async function getAccountRuntimes(cfConfig) {
190191async function runTestPipeline ( cfConfig , runtimeName ) {
191192 let selection = String (
192193 prompt (
193- '\nTo troubleshoot, we would like to create a Demo Pipeline and run it.\nAfter creating this pipeline we will clean up the resources\ n\nWould you like to proceed with the demo pipeline? (y/n): ' ,
194+ '\nTo troubleshoot, we would like to create a Demo Pipeline and run it.\n\nWould you like to proceed with the demo pipeline? (y/n): ' ,
194195 ) ,
195196 ) ;
196197 while ( selection !== 'y' && selection !== 'n' ) {
@@ -206,7 +207,7 @@ async function runTestPipeline(cfConfig, runtimeName) {
206207 const projectName = 'CODEFRESH-SUPPORT-PACKAGE' ;
207208 const pipelineName = 'TEST-PIPELINE-FOR-SUPPORT' ;
208209 const pipelineYaml =
209- 'version: "1.0"\n\nsteps:\n\n test :\n title: Running test\n type: freestyle\n arguments:\n image: alpine\n commands:\n - echo "Hello Test"' ;
210+ 'version: "1.0"\n\nsteps:\n\n freestyle :\n title: Running test\n type: freestyle\n arguments:\n image: alpine\n commands:\n - echo "Hello Test"' ;
210211
211212 const project = JSON . stringify ( {
212213 projectName : projectName ,
@@ -240,8 +241,6 @@ async function runTestPipeline(cfConfig, runtimeName) {
240241 const projectStatus = await createProjectResponse . json ( ) ;
241242
242243 if ( ! createProjectResponse . ok ) {
243- console . error ( 'Error creating project:' , createProjectResponse . statusText ) ;
244- console . error ( projectStatus ) ;
245244 const getProjectID = await fetch ( `${ cfConfig . baseUrl } /projects/name/${ projectName } ` , {
246245 method : 'GET' ,
247246 headers : cfConfig . headers ,
@@ -263,8 +262,6 @@ async function runTestPipeline(cfConfig, runtimeName) {
263262
264263 if ( ! createPipelineResponse . ok ) {
265264 try {
266- console . error ( 'Error creating pipeline:' , createPipelineResponse . statusText ) ;
267- console . error ( pipelineStatus ) ;
268265 const getPipelineID = await fetch ( `${ cfConfig . baseUrl } /pipelines/${ projectName } %2f${ pipelineName } ` , {
269266 method : 'GET' ,
270267 headers : cfConfig . headers ,
@@ -316,27 +313,6 @@ async function runTestPipeline(cfConfig, runtimeName) {
316313 return { pipelineID : pipelineStatus . metadata . id , projectID : projectStatus . id , buildID : runPipelineStatus } ;
317314}
318315
319- async function deleteTestPipeline ( cfConfig , pipelineID , projectID ) {
320- const deletePipelineResponse = await fetch ( `${ cfConfig . baseUrl } /pipelines/${ pipelineID } ` , {
321- method : 'DELETE' ,
322- headers : cfConfig . headers ,
323- } ) ;
324-
325- if ( ! deletePipelineResponse . ok ) {
326- throw new Error ( 'Error deleting pipeline:' , await deletePipelineResponse . text ( ) ) ;
327- }
328-
329- const deleteProjectResponse = await fetch ( `${ cfConfig . baseUrl } /projects/${ projectID } ` , {
330- method : 'DELETE' ,
331- headers : cfConfig . headers ,
332- } ) ;
333-
334- if ( ! deleteProjectResponse . ok ) {
335- throw new Error ( 'Error deleting project:' , await deleteProjectResponse . text ( ) ) ;
336- }
337-
338- console . log ( 'Demo pipeline and project deleted successfully.' ) ;
339- }
340316
341317async function gatherPipelinesRuntime ( cfConfig ) {
342318 try {
@@ -382,7 +358,6 @@ async function gatherPipelinesRuntime(cfConfig) {
382358
383359 if ( pipelineExecutionOutput ) {
384360 await Deno . writeTextFile ( `${ dirPath } /testPipelineBuildId.txt` , pipelineExecutionOutput . buildID ) ;
385- await deleteTestPipeline ( cfConfig , pipelineExecutionOutput . pipelineID , pipelineExecutionOutput . projectID ) ;
386361 }
387362
388363 await prepareAndCleanup ( ) ;
@@ -498,7 +473,7 @@ async function writeGetApiCalls(resources, k8sType) {
498473
499474async function prepareAndCleanup ( ) {
500475 console . log ( `Saving data to ${ supportPackageZip } ` ) ;
501- await compress ( dirPath , ` ${ supportPackageZip } ` , { overwrite : true } ) ;
476+ await tgz . compress ( dirPath , supportPackageZip ) ;
502477
503478 console . log ( 'Cleaning up temp directory' ) ;
504479 await Deno . remove ( dirPath , { recursive : true } ) ;
0 commit comments