Skip to content

Commit bd478bb

Browse files
author
Yuriy Bezsonov
committed
Update known_hosts
1 parent 5e1d852 commit bd478bb

2 files changed

Lines changed: 58 additions & 60 deletions

File tree

infrastructure/cdk/src/main/resources/bootstrapGitea.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ PUB_KEY=$(sudo cat /home/ec2-user/.ssh/id_rsa.pub)
167167
TITLE="$(hostname)$(date +%s)"
168168

169169
while [[ $(curl -s -o /dev/null -w "%{http_code}" localhost:9000/) != "200" ]]; do echo "Gitea is not yet available ..." && sleep 5; done
170+
# Add the host key to known_hosts
171+
sudo -u ec2-user bash -c "ssh-keyscan -p 2222 $EC2_PRIVATE_IP >> ~/.ssh/known_hosts"
170172

171173
curl -X 'POST' \
172174
"http://workshop-user:$IDE_PASSWORD@localhost:9000/api/v1/user/keys" \
@@ -186,7 +188,4 @@ export GITEA_PASSWORD="$IDE_PASSWORD"
186188
export GITEA_USERNAME="workshop-user"
187189
EOF
188190

189-
# Add the host key to known_hosts
190-
ssh-keyscan -p 2222 $EC2_PRIVATE_IP >> ~/.ssh/known_hosts
191-
192191
source /etc/profile.d/gitea.sh

infrastructure/cfn/ide-gitea-stack.yaml

Lines changed: 56 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ Resources:
422422
VSCodeIdeGiteaIdeLogGroupCD76FEFA:
423423
Type: AWS::Logs::LogGroup
424424
Properties:
425-
LogGroupName: ide-bootstrap-log-20250316-121809
425+
LogGroupName: ide-bootstrap-log-20250316-125839
426426
RetentionInDays: 7
427427
UpdateReplacePolicy: Retain
428428
DeletionPolicy: Retain
@@ -855,8 +855,8 @@ Resources:
855855
parameters:
856856
BootstrapScript:
857857
default: ""
858-
type: String
859858
description: (Optional) Custom bootstrap script to run.
859+
type: String
860860
mainSteps:
861861
- inputs:
862862
runCommand:
@@ -1112,58 +1112,16 @@ Resources:
11121112
/opt/aws/bin/cfn-signal -e $exit_code '${waitConditionHandleUrl}'
11131113
11141114
exit $exit_code
1115-
- waitConditionHandleUrl:
1116-
Ref: VSCodeIdeGiteaIdeBootstrapWaitConditionHandle78036ED5
1117-
readmeUrl: ""
1115+
- splashUrl: ""
11181116
instanceIamRoleArn:
11191117
Fn::GetAtt:
11201118
- VSCodeIdeGiteaIdeRole90308F47
11211119
- Arn
1122-
splashUrl: ""
1123-
instanceIamRoleName:
1124-
Ref: VSCodeIdeGiteaIdeRole90308F47
1125-
codeServerVersion: 4.98.2
1126-
customBootstrapScript: |
1127-
date
1128-
1129-
echo '=== Clone Git repository ==='
1130-
sudo -H -u ec2-user bash -c "git clone https://github.com/aws-samples/java-on-aws ~/java-on-aws/"
1131-
# sudo -H -u ec2-user bash -c "cd ~/java-on-aws && git checkout refactoring"
1132-
1133-
echo '=== Setup IDE ==='
1134-
sudo -H -i -u ec2-user bash -c "~/java-on-aws/infrastructure/scripts/setup/ide.sh"
1135-
passwordName:
1136-
Fn::Join:
1137-
- "-"
1138-
- - Fn::Select:
1139-
- 0
1140-
- Fn::Split:
1141-
- "-"
1142-
- Fn::Select:
1143-
- 6
1144-
- Fn::Split:
1145-
- ":"
1146-
- Ref: VSCodeIdeGiteaIdePasswordSecretD25F73F4
1147-
- Fn::Select:
1148-
- 1
1149-
- Fn::Split:
1150-
- "-"
1151-
- Fn::Select:
1152-
- 6
1153-
- Fn::Split:
1154-
- ":"
1155-
- Ref: VSCodeIdeGiteaIdePasswordSecretD25F73F4
1156-
- Fn::Select:
1157-
- 2
1158-
- Fn::Split:
1159-
- "-"
1160-
- Fn::Select:
1161-
- 6
1162-
- Fn::Split:
1163-
- ":"
1164-
- Ref: VSCodeIdeGiteaIdePasswordSecretD25F73F4
1165-
environmentContentsZip: ""
1166-
terminalOnStartup: "true"
1120+
readmeUrl: ""
1121+
waitConditionHandleUrl:
1122+
Ref: VSCodeIdeGiteaIdeBootstrapWaitConditionHandle78036ED5
1123+
extensions: ms-azuretools.vscode-docker,ms-kubernetes-tools.vscode-kubernetes-tools,vscjava.vscode-java-pack
1124+
domain: ""
11671125
installGitea: |
11681126
dnf install -y nerdctl cni-plugins
11691127
mkdir -p /gitea/config /gitea/data
@@ -1334,6 +1292,8 @@ Resources:
13341292
TITLE="$(hostname)$(date +%s)"
13351293
13361294
while [[ $(curl -s -o /dev/null -w "%{http_code}" localhost:9000/) != "200" ]]; do echo "Gitea is not yet available ..." && sleep 5; done
1295+
# Add the host key to known_hosts
1296+
sudo -u ec2-user bash -c "ssh-keyscan -p 2222 $EC2_PRIVATE_IP >> ~/.ssh/known_hosts"
13371297
13381298
curl -X 'POST' \
13391299
"http://workshop-user:$IDE_PASSWORD@localhost:9000/api/v1/user/keys" \
@@ -1353,12 +1313,51 @@ Resources:
13531313
export GITEA_USERNAME="workshop-user"
13541314
EOF
13551315
1356-
# Add the host key to known_hosts
1357-
ssh-keyscan -p 2222 $EC2_PRIVATE_IP >> ~/.ssh/known_hosts
1358-
13591316
source /etc/profile.d/gitea.sh
1360-
domain: ""
1361-
extensions: ms-azuretools.vscode-docker,ms-kubernetes-tools.vscode-kubernetes-tools,vscjava.vscode-java-pack
1317+
terminalOnStartup: "true"
1318+
environmentContentsZip: ""
1319+
passwordName:
1320+
Fn::Join:
1321+
- "-"
1322+
- - Fn::Select:
1323+
- 0
1324+
- Fn::Split:
1325+
- "-"
1326+
- Fn::Select:
1327+
- 6
1328+
- Fn::Split:
1329+
- ":"
1330+
- Ref: VSCodeIdeGiteaIdePasswordSecretD25F73F4
1331+
- Fn::Select:
1332+
- 1
1333+
- Fn::Split:
1334+
- "-"
1335+
- Fn::Select:
1336+
- 6
1337+
- Fn::Split:
1338+
- ":"
1339+
- Ref: VSCodeIdeGiteaIdePasswordSecretD25F73F4
1340+
- Fn::Select:
1341+
- 2
1342+
- Fn::Split:
1343+
- "-"
1344+
- Fn::Select:
1345+
- 6
1346+
- Fn::Split:
1347+
- ":"
1348+
- Ref: VSCodeIdeGiteaIdePasswordSecretD25F73F4
1349+
customBootstrapScript: |
1350+
date
1351+
1352+
echo '=== Clone Git repository ==='
1353+
sudo -H -u ec2-user bash -c "git clone https://github.com/aws-samples/java-on-aws ~/java-on-aws/"
1354+
# sudo -H -u ec2-user bash -c "cd ~/java-on-aws && git checkout refactoring"
1355+
1356+
echo '=== Setup IDE ==='
1357+
sudo -H -i -u ec2-user bash -c "~/java-on-aws/infrastructure/scripts/setup/ide.sh"
1358+
codeServerVersion: 4.98.2
1359+
instanceIamRoleName:
1360+
Ref: VSCodeIdeGiteaIdeRole90308F47
13621361
name: IdeBootstrapFunction
13631362
action: aws:runShellScript
13641363
DocumentFormat: YAML
@@ -1498,10 +1497,10 @@ Resources:
14981497
- Arn
14991498
InstanceId:
15001499
Ref: VSCodeIdeGiteaIdeEC2Instance51274E6D
1501-
SsmDocument:
1502-
Ref: VSCodeIdeGiteaIdeBootstrapDocument7FC8732A
15031500
LogGroupName:
15041501
Ref: VSCodeIdeGiteaIdeLogGroupCD76FEFA
1502+
SsmDocument:
1503+
Ref: VSCodeIdeGiteaIdeBootstrapDocument7FC8732A
15051504
UpdateReplacePolicy: Delete
15061505
DeletionPolicy: Delete
15071506
Outputs:

0 commit comments

Comments
 (0)