Skip to content

Commit 8b37f73

Browse files
authored
added the code from pull machulav#224 (machulav#230)
1 parent f9ecdd9 commit 8b37f73

File tree

9 files changed

+174
-20
lines changed

9 files changed

+174
-20
lines changed

.env.example

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Create .env file using this file as a template.
44
# Define all your variables for local development as described below.
5-
#
5+
#
66
# - Use environment variables with prefix "AWS_" to give access to your test AWS account.
77
# - Use environment variables with prefix "INPUT_" to simulate GitHub Actions input.
88
# - Use GITHUB_REPOSITORY environment variable to provide the GitHub repository and it's owher as a context in the script. Use formst "owner/repo".
@@ -19,3 +19,6 @@ INPUT_SECURITY-GROUP-ID=
1919
INPUT_LABEL=
2020
INPUT_EC2-INSTANCE-ID=
2121
GITHUB_REPOSITORY=
22+
INPUT_EC2-VOLUME-SIZE=
23+
INPUT_EC2-DEVICE-NAME=
24+
INPUT_EC2-VOLUME-TYPE=

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ Use the following steps to prepare your workflow for running on your EC2 self-ho
147147

148148
> [!IMPORTANT]
149149
> If you are planning on using Spot instances for your runner, AWS uses a service-linked role to provision the instances.
150-
>
150+
>
151151
> For this to work, at least one of the following must be true:
152152
> - The service-linked role exists already. This happens if you request a Spot instance via the AWS Console interface.
153153
> - You create the service-linked role via the Console, AWS CLI or AWS API.
@@ -189,7 +189,7 @@ Alternatively, you can use a vanilla EC2 AMI and set up the dependencies via `pr
189189
Or use the existing VPC and subnet.
190190
2. Create a new security group for the runners in the VPC.
191191
Only **outbound** traffic on port TCP/443 is required to pull jobs from GitHub.
192-
No inbound traffic is required for this purpose, but if your workflow needs to access external repositories or internal SSH, other ports like TCP/22, TCP/80, etc ... may be required.
192+
No inbound traffic is required for this purpose, but if your workflow needs to access external repositories or internal SSH, other ports like TCP/22, TCP/80, etc ... may be required.
193193

194194
**5. Configure the GitHub workflow**
195195

@@ -220,7 +220,10 @@ Now you're ready to go!
220220
| `block-device-mappings` | Optional. Used only with the `start` mode. | JSON string specifying the block device mappings for the EC2 instance. For example: <br> <pre>[{"DeviceName": "/dev/sda1", "Ebs": {"VolumeSize": 100, "VolumeType": "gp3"}}]</pre> See <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_BlockDeviceMapping.html">AWS BlockDeviceMapping docs</a> for all options. |
221221
| `startup-quiet-period-seconds` | Optional | Default: 30 |
222222
| `startup-retry-interval-seconds` | Optional | Default: 10 |
223-
| `startup-timeout-minutes` | Optional | Default: 5 |
223+
| `startup-timeout-minutes` | Optional | Default: 5 |
224+
| `ec2-volume-size` | Optional | Defines the size of the EC2 Volume in GB, will use the AWS default of 8 GB if not provided. |
225+
| `ec2-device-name` | Optional | Defines the device name used for the root volume. |
226+
| `ec2-volume-type` | Optional | Defines the device type used for the root volume. |
224227

225228
### Environment variables
226229

action.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,22 @@ inputs:
9999
run-runner-as-user:
100100
description: >-
101101
Specify user under whom the runner service should run
102+
ec2-volume-size:
103+
description: >-
104+
EC2 volume size in GB.
105+
default: "8"
106+
required: false
107+
ec2-device-name:
108+
description: >-
109+
EC2 block device name.
110+
default: /dev/sda1
111+
required: false
112+
ec2-volume-type:
113+
description: >-
114+
EC2 block device type.
115+
default: gp2
116+
required: false
117+
102118
outputs:
103119
label:
104120
description: >-

dist/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145081,6 +145081,15 @@ async function startEc2Instance(label, githubRegistrationToken) {
145081145081
IamInstanceProfile: { Name: config.input.iamRoleName },
145082145082
TagSpecifications: config.tagSpecifications,
145083145083
InstanceMarketOptions: buildMarketOptions(),
145084+
BlockDeviceMappings: [
145085+
{
145086+
DeviceName: config.input.ec2DeviceName,
145087+
Ebs: {
145088+
VolumeSize: config.input.ec2VolumeSize,
145089+
VolumeType: config.input.ec2VolumeType,
145090+
},
145091+
},
145092+
],
145084145093
};
145085145094

145086145095
if (config.input.blockDeviceMappings.length > 0) {
@@ -145177,6 +145186,9 @@ class Config {
145177145186
subnetId: core.getInput('subnet-id'),
145178145187
runAsService: core.getInput('run-runner-as-service') === 'true',
145179145188
runAsUser: core.getInput('run-runner-as-user'),
145189+
ec2VolumeSize: core.getInput('ec2-volume-size'),
145190+
ec2DeviceName: core.getInput('ec2-device-name'),
145191+
ec2VolumeType: core.getInput('ec2-volume-type'),
145180145192
blockDeviceMappings: JSON.parse(core.getInput('block-device-mappings') || '[]')
145181145193
};
145182145194

hello.save

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Hi,
2+
3+
We have observed a consistently poor acceptance rate for Norway over the past few months, leading to significant financial losses, which we estimate to be in the millions. We have been in contact with Kustom, who provided us with data confirming this issue, and we have drawn the following conclusion:
4+
We have compared the Swedish and Norwegian markets in terms of renewal acceptance rates over the past 60 days. The discrepancy between the two markets is highly concerning, with Norway's acceptance rate being significantly lower.
5+
This is a matter of great urgency, and we expect you to respond immediately with a detailed plan on how you intend to resolve this issue, as well as the steps you will take to mitigate our losses going forward. It is unacceptable for a payment provider of your size—especially one approaching an IPO—to be experiencing such critical issues.

package-lock.json

Lines changed: 116 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020
"@actions/core": "^1.10.0",
2121
"@actions/github": "^6.0.0",
2222
"@aws-sdk/client-ec2": "^3.557.0",
23-
"lodash": "^4.17.21"
23+
"lodash": "^4.17.21",
24+
"ncc": "^0.3.6"
2425
},
2526
"devDependencies": {
2627
"@vercel/ncc": "^0.38.1",
2728
"dotenv": "^8.6.0",
2829
"eslint": "^7.32.0"
2930
}
30-
}
31+
}

src/aws.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ async function startEc2Instance(label, githubRegistrationToken) {
7373
IamInstanceProfile: { Name: config.input.iamRoleName },
7474
TagSpecifications: config.tagSpecifications,
7575
InstanceMarketOptions: buildMarketOptions(),
76+
BlockDeviceMappings: [
77+
{
78+
DeviceName: config.input.ec2DeviceName,
79+
Ebs: {
80+
VolumeSize: config.input.ec2VolumeSize,
81+
VolumeType: config.input.ec2VolumeType,
82+
},
83+
},
84+
],
7685
};
7786

7887
if (config.input.blockDeviceMappings.length > 0) {

src/config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ class Config {
2121
subnetId: core.getInput('subnet-id'),
2222
runAsService: core.getInput('run-runner-as-service') === 'true',
2323
runAsUser: core.getInput('run-runner-as-user'),
24+
ec2VolumeSize: core.getInput('ec2-volume-size'),
25+
ec2DeviceName: core.getInput('ec2-device-name'),
26+
ec2VolumeType: core.getInput('ec2-volume-type'),
2427
blockDeviceMappings: JSON.parse(core.getInput('block-device-mappings') || '[]')
2528
};
2629

0 commit comments

Comments
 (0)