Skip to content

Commit 3896d5c

Browse files
author
Yuriy Bezsonov
committed
WIP
1 parent 0967738 commit 3896d5c

File tree

3 files changed

+12
-32
lines changed

3 files changed

+12
-32
lines changed

infra/cdk/src/main/java/sample/com/constructs/CodeBuild.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,12 @@ public CodeBuild(final Construct scope, final String id, final CodeBuildProps pr
133133

134134
// Create start build Lambda function
135135
var startLambda = new Lambda(this, "StartLambda",
136-
"/lambda/codebuild-start.py", Aws.STACK_NAME + "-codebuild-start", Duration.minutes(2), lambdaRole);
136+
"/lambda/codebuild-start.py", "ide-codebuild-start", Duration.minutes(2), lambdaRole);
137137
Function startBuildFunction = startLambda.getFunction();
138138

139139
// Create report build Lambda function
140140
var reportLambda = new Lambda(this, "ReportLambda",
141-
"/lambda/codebuild-report.py", Aws.STACK_NAME + "-codebuild-report", Duration.minutes(2), lambdaRole);
141+
"/lambda/codebuild-report.py", "ide-codebuild-report", Duration.minutes(2), lambdaRole);
142142
Function reportBuildFunction = reportLambda.getFunction();
143143

144144
// Create EventBridge rule for build completion

infra/scripts/ide/base.sh

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,14 @@ handle_error() {
5555
exit 1
5656
}
5757

58-
# Helper function for download verification
58+
# Helper function for download verification with retry
5959
download_and_verify() {
6060
local url="$1"
6161
local output="$2"
6262
local description="$3"
6363

6464
log_info "Downloading $description..."
65-
if ! wget -q "$url" -O "$output"; then
66-
handle_error "Failed to download $description from $url"
67-
fi
65+
retry_critical "wget -q '$url' -O '$output'"
6866
}
6967

7068
cd /tmp
@@ -97,9 +95,7 @@ install_nodejs() {
9795
log_info "Installing Node.js ${NODE_VERSION} and tools..."
9896

9997
# Install NVM
100-
if ! curl -sS -o- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash; then
101-
handle_error "Failed to install NVM"
102-
fi
98+
retry_critical "curl -sS -o- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash"
10399

104100
# Setup NVM environment
105101
export NVM_DIR="$HOME/.nvm"
@@ -128,9 +124,7 @@ install_maven() {
128124
local mvn_filename=apache-maven-${MAVEN_VERSION}-bin.tar.gz
129125
local mvn_url="https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/${mvn_filename}"
130126

131-
if ! curl -sS -4 -L "$mvn_url" | tar -xz; then
132-
handle_error "Failed to download and extract Maven"
133-
fi
127+
retry_critical "curl -sS -4 -L '$mvn_url' | tar -xz"
134128

135129
sudo mv "$mvn_foldername" /usr/lib/maven
136130
echo "export M2_HOME=/usr/lib/maven" | sudo tee -a /etc/profile.d/workshop.sh >/dev/null
@@ -181,9 +175,7 @@ install_kubernetes_tools() {
181175
# log_info "eksctl version: $(eksctl version)"
182176

183177
log_info "Installing Helm ${HELM_VERSION}..."
184-
if ! curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3; then
185-
handle_error "Failed to download Helm installer"
186-
fi
178+
retry_critical "curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3"
187179
chmod 700 get_helm.sh
188180
./get_helm.sh --version v${HELM_VERSION}
189181
helm completion bash >> ~/.bash_completion
@@ -195,14 +187,10 @@ install_kubernetes_tools() {
195187
sudo mv eks-node-viewer /usr/local/bin
196188

197189
log_info "Installing k9s..."
198-
if ! curl -sS https://webinstall.dev/k9s | bash; then
199-
echo "Warning: k9s installation failed, continuing..."
200-
fi
190+
retry_optional "curl -sS https://webinstall.dev/k9s | bash"
201191

202192
log_info "Installing e1s..."
203-
if ! curl -sL https://raw.githubusercontent.com/keidarcy/e1s-install/master/cloudshell-install.sh | bash; then
204-
echo "Warning: e1s installation failed, continuing..."
205-
fi
193+
retry_optional "curl -sL https://raw.githubusercontent.com/keidarcy/e1s-install/master/cloudshell-install.sh | bash"
206194
}
207195

208196
install_kubernetes_tools

infra/workshop-template.yaml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,11 +1238,7 @@ Resources:
12381238
responseData = {'Error': tb_err}
12391239
12401240
cfnresponse.send(event, context, status, responseData, physical_id)
1241-
FunctionName:
1242-
Fn::Join:
1243-
- ""
1244-
- - Ref: AWS::StackName
1245-
- -codebuild-start
1241+
FunctionName: ide-codebuild-start
12461242
Handler: index.lambda_handler
12471243
Role:
12481244
Fn::GetAtt:
@@ -1308,11 +1304,7 @@ Resources:
13081304
'error': str(e)
13091305
})
13101306
}
1311-
FunctionName:
1312-
Fn::Join:
1313-
- ""
1314-
- - Ref: AWS::StackName
1315-
- -codebuild-report
1307+
FunctionName: ide-codebuild-report
13161308
Handler: index.lambda_handler
13171309
Role:
13181310
Fn::GetAtt:
@@ -1372,7 +1364,7 @@ Resources:
13721364
Fn::GetAtt:
13731365
- CodeBuildCodeBuildRoleBA9C6D5C
13741366
- Arn
1375-
ContentHash: "1765688713844"
1367+
ContentHash: "1765690723450"
13761368
DependsOn:
13771369
- CodeBuildBuildCompleteRuleAllowEventRuleWorkshopStackCodeBuildReportLambdaFunctionD77C6091DA4A4BD8
13781370
- CodeBuildBuildCompleteRule06AAF17D

0 commit comments

Comments
 (0)