Skip to content

Commit c5b72a5

Browse files
author
Tanmay Sardesai
authored
update goci and ci-scripts to use entity endpoint only (#176)
and delete unused scripts
1 parent 04ca3ff commit c5b72a5

File tree

10 files changed

+16
-203
lines changed

10 files changed

+16
-203
lines changed

VERSION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
v1.4.0
2-
run validate as last step on artifact-build-publish-deploy
1+
v1.5.0
2+
catalog sync is now uses entity endpoint for everything
33

44
Previously:
5+
- run validate as last step on artifact-build-publish-deploy
56
- upgrade all aws sdk v2 modules
67
- reverting node version validation for now
78
- goci now supports validation of node version
@@ -11,4 +12,3 @@ Previously:
1112
- Updating goci warning message, including recent version release date
1213
- Supporting lazy loading of environment variables
1314
- updated parsing of go version from go.mod
14-
- goci now supports validation of go version

circleci/catalog-sync

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# Usage:
77
#
8-
# catalog-sync [CIRCLE_CI_INTEGRATIONS_URL] [USER] [PASS] [APP_NAME]
8+
# catalog-sync [CIRCLE_CI_INTEGRATIONS_URL] [USER] [PASS] [ENTITY_NAME] [TYPE]
99
#
1010

1111
set -e
@@ -24,16 +24,18 @@ USER=$2
2424
if [[ -z $USER ]]; then echo "Missing arg2 USER" && exit 1; fi
2525
PASS=$3
2626
if [[ -z $PASS ]]; then echo "Missing arg3 PASS" && exit 1; fi
27-
APP_NAME=$4
28-
if [[ -z $APP_NAME ]]; then echo "Missing arg4 APP_NAME" && exit 1; fi
27+
ENTITY_NAME=$4
28+
if [[ -z $ENTITY_NAME ]]; then echo "Missing arg4 ENTITY_NAME" && exit 1; fi
29+
TYPE=$5
30+
if [[ -z $TYPE ]]; then echo "Missing arg5 TYPE" && exit 1; fi
2931

3032
echo "Posting to catalog sync service..."
3133
SC=$(curl -u $USER:$PASS \
3234
--retry 5 \
3335
-w "%{http_code}" \
3436
-H "Content-Type: application/json" \
3537
-X POST \
36-
$CIRCLE_CI_INTEGRATIONS_URL/serviceCatalog?app=$APP_NAME)
38+
$CIRCLE_CI_INTEGRATIONS_URL/catalogEntity?entity=$ENTITY_NAME&type=$TYPE)
3739

3840
if [ "$SC" -eq 200 ]; then
3941
echo "Successfully published app catalog config"

circleci/catapult-publish

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ fi
122122

123123
# publish catalog app config
124124
CATALOG_SYNC_SCRIPT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )/catalog-sync"
125-
"${CATALOG_SYNC_SCRIPT}" $CIRCLE_CI_INTEGRATIONS_URL $CATAPULT_USER $CATAPULT_PASS $APP_NAME
125+
"${CATALOG_SYNC_SCRIPT}" $CIRCLE_CI_INTEGRATIONS_URL $CATAPULT_USER $CATAPULT_PASS $APP_NAME "application"
126126

127127
# publish dep info
128128
BREAKDOWN_SYNC_SCRIPT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )/breakdown-sync"

circleci/catapult-publish-lambda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ fi
128128

129129
# publish catalog app config
130130
CATALOG_SYNC_SCRIPT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )/catalog-sync"
131-
"${CATALOG_SYNC_SCRIPT}" $CIRCLE_CI_INTEGRATIONS_URL $CATAPULT_USER $CATAPULT_PASS $APP_NAME
131+
"${CATALOG_SYNC_SCRIPT}" $CIRCLE_CI_INTEGRATIONS_URL $CATAPULT_USER $CATAPULT_PASS $APP_NAME "application"
132132

133133
# publish dep info
134134
BREAKDOWN_SYNC_SCRIPT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )/breakdown-sync"

circleci/catapult-publish-spark

Lines changed: 0 additions & 56 deletions
This file was deleted.

circleci/golang-install

Lines changed: 0 additions & 53 deletions
This file was deleted.

circleci/golang-move-project

Lines changed: 0 additions & 59 deletions
This file was deleted.

circleci/report-card

Lines changed: 0 additions & 10 deletions
This file was deleted.

cmd/goci/main.go

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -282,23 +282,11 @@ func publishUtility() error {
282282
return fmt.Errorf("failed to read catalog-info.yaml file: %v", err)
283283
}
284284

285-
// Check to see if type is defined on Spec
286-
if catalogInfo.Spec == nil {
287-
return fmt.Errorf("catalog-info.yaml file does not contain a valid spec")
288-
}
289-
if _, ok := catalogInfo.Spec["type"]; !ok {
290-
return fmt.Errorf("catalog-info.yaml file does not contain a valid type in spec")
291-
}
292-
typeVal, ok := catalogInfo.Spec["type"].(string)
293-
if !ok {
294-
return fmt.Errorf("catalog-info.yaml file does not contain a valid type in spec")
295-
}
296-
297285
cp := catapult.New()
298286

299287
err = cp.SyncCatalogEntity(context.Background(), &ciIntegrationsModels.SyncCatalogEntityInput{
300288
Entity: catalogInfo.GetName(),
301-
Type: typeVal,
289+
Type: "utility",
302290
})
303291
if err != nil {
304292
return fmt.Errorf("failed to sync catalog entity with catapult: %v", err)

internal/catapult/catapult.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func New() *Catapult {
4646

4747
// SyncCatalogEntity syncs passed in entity to catalog-config by calling circle-ci-integrations
4848
func (c *Catapult) SyncCatalogEntity(ctx context.Context, entity *models.SyncCatalogEntityInput) error {
49-
fmt.Println("Syncing catalog entity", entity.Entity)
49+
fmt.Printf("Syncing catalog entity %s with type %s\n", entity.Entity, entity.Type)
5050
err := c.client.SyncCatalogEntity(ctx, entity)
5151
if err != nil {
5252
return fmt.Errorf("failed to sync catalog entity %s with catalogue config: %v", entity.Entity, err)
@@ -71,8 +71,9 @@ func (c *Catapult) Publish(ctx context.Context, artifacts []*Artifact) error {
7171
return fmt.Errorf("failed to publish %s with catapult: %v", art.ID, err)
7272
}
7373

74-
err = c.client.SyncCatalogApp(grpCtx, &models.SyncCatalogAppInput{
75-
App: art.ID,
74+
err = c.SyncCatalogEntity(grpCtx, &models.SyncCatalogEntityInput{
75+
Entity: art.ID,
76+
Type: "application",
7677
})
7778
if err != nil {
7879
fmt.Println("failed to sync catalog app", art.ID, "with catalogue config:", err)

0 commit comments

Comments
 (0)