Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
galargh committed Jan 31, 2024
1 parent 4193caf commit 2a4f7a0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
10 changes: 6 additions & 4 deletions .github/actions/docker-cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ runs:
const callerIdentity = await exec.getExecOutput('aws sts get-caller-identity');
const arn = JSON.parse(callerIdentity.stdout).Arn;
const prefix = `${arn.match(/\/(.+)-runner-role\//)[1]}/docker/cache/v0/docker/registry/v2/`;
const prefix = process.env.IPDX_S3_BUCKET_PREFIX;
const name = process.env.INPUTS_NAME || process.env.GITHUB_REPOSITORY
const name = process.env.INPUTS_NAME || process.env.GITHUB_REPOSITORY;
const bucket = process.env.IPDX_S3_BUCKET_NAME;
return {
to: `type=s3,mode=max,prefix=${prefix},bucket=tf-aws-gh-runner,region=us-east-1,name=${name}`,
from: `type=s3,prefix=${prefix},bucket=tf-aws-gh-runner,region=us-east-1,name=${name}`,
to: `type=s3,mode=max,prefix=${prefix},bucket=${bucket},region=us-east-1,name=${name}`,
from: `type=s3,prefix=${prefix},bucket=${bucket},region=us-east-1,name=${name}`,
instance: instance.stdout
}
result-encoding: json
6 changes: 2 additions & 4 deletions .github/actions/download-artifact/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,15 @@ runs:
INPUTS_DESTINATION: ${{ inputs.destination }}
with:
script: |
const callerIdentity = await exec.getExecOutput('aws sts get-caller-identity');
const arn = JSON.parse(callerIdentity.stdout).Arn;
const prefix = arn.match(/\/(.+)-runner-role\//)[1];
const prefix = process.env.IPDX_S3_BUCKET_PREFIX;
const source = process.env.INPUTS_SOURCE;
const destination = process.env.INPUTS_DESTINATION || source;
const sourceFullPath = `${prefix}/${process.env.GITHUB_REPOSITORY}/${process.env.GITHUB_RUN_ID}/${process.env.GITHUB_RUN_ATTEMPT}/${source}`
const recursiveOption = source.endsWith('/') ? '--recursive' : '';
const bucket = 'tf-aws-gh-runner'
const bucket = process.env.IPDX_S3_BUCKET_NAME;
await exec.exec(`aws s3 cp s3://${bucket}/${sourceFullPath} ${destination} ${recursiveOption}`)
Expand Down
6 changes: 2 additions & 4 deletions .github/actions/upload-artifact/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ runs:
const fs = require('fs');
const path = require('path');
const callerIdentity = await exec.getExecOutput('aws sts get-caller-identity');
const arn = JSON.parse(callerIdentity.stdout).Arn;
const prefix = arn.match(/\/(.+)-runner-role\//)[1];
const prefix = process.env.IPDX_S3_BUCKET_PREFIX;
const source = process.env.INPUTS_SOURCE;
const destination = process.env.INPUTS_DESTINATION || source;
Expand All @@ -36,7 +34,7 @@ runs:
const destinationFullPath = `${prefix}/${process.env.GITHUB_REPOSITORY}/${process.env.GITHUB_RUN_ID}/${process.env.GITHUB_RUN_ATTEMPT}/${destinationPath}`
const recursiveOption = fs.lstatSync(source).isDirectory() ? '--recursive' : '';
const bucket = 'tf-aws-gh-runner'
const bucket = process.env.IPDX_S3_BUCKET_NAME;
await exec.exec(`aws s3 cp ${source} s3://${bucket}/${destinationFullPath} ${recursiveOption} --acl public-read`)
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/playground.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ jobs:
name: Play
runs-on: ["self-hosted", "linux", "x64", "large"]
steps:
- run: |
TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 180"` \
&& curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/
- run: echo "Hello, world!" > hello.txt
shell: bash
- uses: ipdxco/custom-github-runners/.github/actions/upload-artifact@meta
with:
source: hello.txt
destination: remote.txt
- uses: ipdxco/custom-github-runners/.github/actions/download-artifact@meta
with:
source: remote.txt
destination: goodbye.txt
- run: cat goodbye.txt
shell: bash

0 comments on commit 2a4f7a0

Please sign in to comment.