You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of changes:
* include updating go module version inside `go.mod` file alongwith updating ACK runtime version
* perform `go mod download` and `go mod tidy` before executing `make build-controller` command
* update `go` version to `1.17.5` in all prow images
* use github utility functions for opening PR and issues inside `auto-generate-controllers.sh`
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
@@ -103,20 +114,51 @@ for CONTROLLER_NAME in $CONTROLLER_NAMES; do
103
114
# Find the ACK runtime version in service controller 'go.mod' file
104
115
pushd"$CONTROLLER_DIR">/dev/null
105
116
SERVICE_RUNTIME_VERSION=$(go list -m -f '{{ .Version }}' github.com/aws-controllers-k8s/runtime 2>/dev/null ||echo"$RUNTIME_MISSING_VERSION")
106
-
popd>/dev/null
107
117
108
-
if [[ $SERVICE_RUNTIME_VERSION==$RUNTIME_MISSING_VERSION ]];then
109
-
echo"auto-generate-controllers.sh][ERROR] Unable to determine ACK runtime version from $CONTROLLER_NAME/go.mod file. Skipping $CONTROLLER_NAME"
110
-
continue
111
-
fi
118
+
if [[ $SERVICE_RUNTIME_VERSION==$RUNTIME_MISSING_VERSION ]];then
119
+
echo"auto-generate-controllers.sh][ERROR] Unable to determine ACK runtime version from $CONTROLLER_NAME/go.mod file. Skipping $CONTROLLER_NAME"
120
+
continue
121
+
fi
112
122
113
-
# If the current version is same as latest ACK runtime version, skip this controller.
114
-
if [[ $SERVICE_RUNTIME_VERSION==$ACK_RUNTIME_VERSION ]];then
115
-
echo"auto-generate-controllers.sh][INFO] $CONTROLLER_NAME already has the latest ACK runtime version $ACK_RUNTIME_VERSION. Skipping $CONTROLLER_NAME"
116
-
continue
117
-
fi
123
+
# If the current version is same as latest ACK runtime version, skip this controller.
124
+
if [[ $SERVICE_RUNTIME_VERSION==$ACK_RUNTIME_VERSION ]];then
125
+
echo"auto-generate-controllers.sh][INFO] $CONTROLLER_NAME already has the latest ACK runtime version $ACK_RUNTIME_VERSION. Skipping $CONTROLLER_NAME"
126
+
continue
127
+
else
128
+
echo"auto-generate-controllers.sh][INFO] ACK runtime version for new controller will be $ACK_RUNTIME_VERSION. Current version is $SERVICE_RUNTIME_VERSION"
129
+
echo -n "auto-generate-controllers.sh][INFO] Updating 'go.mod' file for $CONTROLLER_NAME with ACK runtime $ACK_RUNTIME_VERSION ... "
130
+
if! go get -u github.com/aws-controllers-k8s/runtime@"$ACK_RUNTIME_VERSION">/dev/null;then
131
+
echo""
132
+
echo"auto-generate-controllers.sh][ERROR] Unable to update go.mod file with ACK runtime version $ACK_RUNTIME_VERSION"
133
+
continue
134
+
fi
118
135
119
-
echo"auto-generate-controllers.sh][INFO] ACK runtime version for new controller will be $ACK_RUNTIME_VERSION. Current version is $SERVICE_RUNTIME_VERSION"
136
+
echo -n "auto-generate-controllers.sh][INFO] Updating 'go.mod' file for $CONTROLLER_NAME with go version $GO_VERSION_IN_GO_MOD ... "
137
+
if! go mod edit -go="$GO_VERSION_IN_GO_MOD">/dev/null;then
138
+
echo""
139
+
echo"auto-generate-controllers.sh][ERROR] Unable to update go.mod file with go version $GO_VERSION_IN_GO_MOD"
140
+
continue
141
+
fi
142
+
echo"ok"
143
+
144
+
# go dependencies need to be updated otherwise 'make build-controller' command will fail
145
+
echo -n "auto-generate-controllers.sh][INFO] Executing 'go mod download' for $CONTROLLER_NAME after 'go.mod' updates ... "
146
+
if! go mod download >/dev/null;then
147
+
echo""
148
+
echo"auto-generate-controllers.sh][ERROR] Unable to perform 'go mod download' for $CONTROLLER_NAME"
149
+
continue
150
+
fi
151
+
echo"ok"
152
+
153
+
echo -n "auto-generate-controllers.sh][INFO] Executing 'go mod tidy' for $CONTROLLER_NAME after 'go.mod' updates ... "
154
+
if! go mod tidy >/dev/null;then
155
+
echo""
156
+
echo"auto-generate-controllers.sh][ERROR] Unable to perform 'go mod tidy' for $CONTROLLER_NAME"
157
+
continue
158
+
fi
159
+
echo"ok"
160
+
fi
161
+
popd>/dev/null
120
162
121
163
echo -n "auto-generate-controllers.sh][INFO] Ensuring that GitHub label $GITHUB_LABEL exists for $GITHUB_ORG/$CONTROLLER_NAME ... "
122
164
if! gh api repos/"$GITHUB_ORG"/"$CONTROLLER_NAME"/labels/"$GITHUB_LABEL" --silent >/dev/null;then
@@ -157,15 +199,6 @@ for CONTROLLER_NAME in $CONTROLLER_NAMES; do
157
199
echo"auto-generate-controllers.sh][ERROR] Failure while executing 'make build-controller' command. Creating/Updating GitHub issue"
158
200
ISSUE_TITLE="Errors while generating \`$CONTROLLER_NAME\` for ACK runtime \`$ACK_RUNTIME_VERSION\`"
159
201
160
-
echo -n "auto-generate-controllers.sh][INFO] Querying already open GitHub issue ... "
161
-
ISSUE_NUMBER=$(gh issue list -R "$GITHUB_ORG/$GITHUB_ISSUE_REPO" -L 1 -s open --json number -S "$ISSUE_TITLE" --jq '.[0].number' -A @me -l "$GITHUB_LABEL")
162
-
if [[ $?-ne 0 ]];then
163
-
echo""
164
-
echo"auto-generate-controllers.sh][ERROR] Unable to query open github issue. Skipping $CONTROLLER_NAME"
165
-
continue
166
-
fi
167
-
echo"ok"
168
-
169
202
# Capture 'make build-controller' command output & error, then persist
echo"auto-generate-controllers.sh][ERROR] Unable to create GitHub issue for reporting failure. Skipping $CONTROLLER_NAME"
186
-
continue
187
-
fi
188
-
echo"ok"
189
-
continue
190
-
else
191
-
echo -n "auto-generate-controllers.sh][INFO] Updating error output in the body of existing issue#$ISSUE_NUMBER inside $GITHUB_ORG/$GITHUB_ISSUE_REPO ... "
@@ -251,44 +246,15 @@ for CONTROLLER_NAME in $CONTROLLER_NAMES; do
251
246
fi
252
247
echo"ok"
253
248
254
-
# If a PR exists from '$PR_SOURCE_BRANCH' to '$PR_TARGET_BRANCH' then
255
-
# update the PR body with latest successful command output.
256
-
# In case no such PR exists, create a new PR.
257
-
echo -n "auto-generate-controllers.sh][INFO] Finding existing open pull requests ... "
258
-
PR_NUMBER=$(gh pr list -R "$GITHUB_ORG/$CONTROLLER_NAME" -A @me -L 1 -s open --json number -S "$COMMIT_MSG" --jq '.[0].number' -l "$GITHUB_LABEL")
259
-
if [[ $?-ne 0 ]];then
260
-
echo""
261
-
echo"auto-generate-controllers.sh][ERROR] Failed to query for an existing pull request for $GITHUB_ORG/$CONTROLLER_NAME , from $PR_SOURCE_BRANCH -> $PR_TARGET_BRANCH branch"
262
-
else
263
-
echo"ok"
264
-
fi
265
-
266
249
# Capture 'make build-controller' command output, then persist
echo -n "auto-generate-controllers.sh][INFO] No Existing PRs found. Creating a new pull request for $GITHUB_ORG/$CONTROLLER_NAME , from $PR_SOURCE_BRANCH -> $PR_TARGET_BRANCH branch ... "
0 commit comments