How can I hardlink a file in a jenkins file

My common goal is to synchronize the file with S3, and then tightly link it to avoid "many copies" and to save space when creating docker containers. That's what i still have

withAWS(region: 'us-east-1') { s3Download( bucket: 'artifacts.mydomain.tld', file: "${env.ORACLE_RPM}", path: "${env.HOME}/${env.ORACLE_RPM}", ) script { linkBlocking("etc/docker/${env.PROJECT}/${env.ORACLE_RPM}", "${env.HOME}/${env.ORACLE_RPM}") } } 

s3Download works, although I'm not sure that it will update the file if a newer version is available.

However, when I tried to use the FileSystem class, I cannot actually determine the correct calling convention, the constructor is at least underestimated.

+5
source share
1 answer

didn’t figure out how to do this in groovy, when I tried to use Java nio Files , I got a sandbox error, but doing this with a shell step works

  withAWS(region: 'us-east-1') { script { try { s3Download( bucket: 'artifacts.mydomain.tld', file: "${env.HOME}/${env.ORACLE_RPM}", path: "${env.ORACLE_RPM}", ) } catch (Exception e ) {// don't update the file if it exists } finally { sh "ln -f ${env.HOME}/${env.ORACLE_RPM} etc/docker/${env.PROJECT}/${env.ORACLE_RPM}" } } } 
0
source

Source: https://habr.com/ru/post/1275141/


All Articles