Skip to content

Commit 6c81c9f

Browse files
author
insrsa
committed
synch from fork
1 parent 2cba254 commit 6c81c9f

File tree

10 files changed

+2939
-84
lines changed

10 files changed

+2939
-84
lines changed

apis/wMIO_OpenAPI_Spec_v3.yaml

+2,879
Large diffs are not rendered by default.
15 Bytes
Binary file not shown.

assets/github/workflows/dev.yml

+21-19
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
name: DEV
1+
name: DEV
22

3-
# Run this workflow every time a commit gets pushed to main or a pull request gets opened against main
4-
on:
5-
pull_request:
6-
branches:
7-
- dev
3+
# Run this workflow every time a commit gets pushed to main or a pull request gets opened against main
4+
on:
5+
pull_request:
6+
branches:
7+
- dev
8+
jobs:
9+
build:
10+
name: Call Azure Pipeline
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Synchronize Dev
14+
uses: fjogeleit/http-request-action@v1
15+
with:
16+
url: 'https://dev.azure.com/insrsa/webMethodsIO_Integration/_apis/build/builds?api-version=7.1-preview.7'
17+
method: 'POST'
18+
username: 'insrsa@softwareag.com'
19+
password: ${{ secrets.AZURE_DEVOPS_TOKEN }}
20+
customHeaders: '{"Content-Type": "application/json"}'
21+
data: '{"parameters": "{\"repoName\":\"${{ github.event.repository.name }}\",\"synchProject\":\"true\"}","definition":{"id": 24}}'
822

9-
jobs:
10-
build:
11-
name: Call Azure Pipeline
12-
runs-on: ubuntu-latest
13-
steps:
14-
- name: Azure Pipelines Action
15-
uses: Azure/pipelines@v1.2
16-
with:
17-
azure-devops-project-url: https://dev.azure.com/insrsa/webMethodsIO_Integration
18-
azure-pipeline-name: 'sychronizeToDEV'
19-
azure-devops-token: ${{ secrets.AZURE_DEVOPS_TOKEN }}
20-
azure-pipeline-variables: '{"repoName": ${{ github.event.repository.name }}, "synchProject": "true"}' # optional stringified json
21-
23+

assets/resources/test/wmio_test.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@
193193
"variable": [
194194
{
195195
"key": "project",
196-
"value": "wmio_project_d"
196+
"value": "{{project}}"
197197
},
198198
{
199199
"key": "flow",

assets/scaffolds/manifest.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repositories:
88
- repository:
99
name: "wm_onprem_project_a"
1010
url: "https://github.com/chini007/wm_onprem_project_a.git"
11-
type: "OnPrem"
11+
type: "Edge"
1212
pipeline:
1313
- repository:
1414
name: "wm_api_project_a"
11.6 KB
Loading

pipelines/scripts/exportAsset.sh

+12-12
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,17 @@ function exportSingleReferenceData () {
8686
cd ${HOME_DIR}/${repoName}
8787
mkdir -p ./assets/projectConfigs/referenceData
8888
cd ./assets/projectConfigs/referenceData
89-
REF_DATA_URL=${LOCAL_DEV_URL}/integration/rest/external/v1/ut-flow/referencedata/${projectID}/${rdName}
89+
REF_DATA_URL=${LOCAL_DEV_URL}/apis/v1/rest/projects/${repoName}/referencedata/${rdName}
9090
rdJson=$(curl --location --request GET ${REF_DATA_URL} \
9191
--header 'Content-Type: application/json' \
9292
--header 'Accept: application/json' \
9393
-u ${admin_user}:${admin_password})
94-
rdExport=$(echo "$rdJson" | jq '.integration.serviceData.referenceData // empty')
94+
rdExport=$(echo "$rdJson" | jq '.output // empty')
9595
if [ -z "$rdExport" ]; then
9696
echo "Empty reference data defined for the name:" ${rdName}
9797
else
98-
columnDelimiter=$(echo "$rdJson" | jq -c -r '.integration.serviceData.referenceData.columnDelimiter')
99-
rdExport=$(echo "$rdJson" | jq -c -r '.integration.serviceData.referenceData.dataRecords')
98+
columnDelimiter=$(echo "$rdJson" | jq -c -r '.output.columnDelimiter')
99+
rdExport=$(echo "$rdJson" | jq -c -r '.output.dataRecords')
100100
if [[ "$columnDelimiter" == "," ]]; then
101101
echod "COMMA"
102102
datajson=$(echo "$rdExport" | jq -c -r '(map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv')
@@ -109,13 +109,13 @@ function exportSingleReferenceData () {
109109
mkdir -p ${rdName}
110110
cd ${rdName}
111111

112-
metadataJson=$(echo "$rdJson" | jq -c -r '.integration.serviceData.referenceData')
112+
metadataJson=$(echo "$rdJson" | jq -c -r '.output')
113113
metadataJson=$(echo "$metadataJson"| jq 'del(.columnNames, .dataRecords, .revisionData)')
114114
echo "$metadataJson" > metadata.json
115115
echo "$datajson" > ${source_type}.csv
116-
cp ./${source_type}.csv dev.csv
117-
cp ./${source_type}.csv qa.csv
118-
cp ./${source_type}.csv prod.csv
116+
cp -n ./${source_type}.csv dev.csv
117+
cp -n ./${source_type}.csv qa.csv
118+
cp -n ./${source_type}.csv prod.csv
119119
cd -
120120
fi
121121
cd ${HOME_DIR}/${repoName}
@@ -150,19 +150,19 @@ function exportReferenceData (){
150150

151151
echod "ProjectID:" ${projectID}
152152

153-
PROJECT_REF_DATA_LIST_URL=${LOCAL_DEV_URL}/integration/rest/external/v1/ut-flow/referencedata/${projectID}
153+
PROJECT_REF_DATA_LIST_URL=${LOCAL_DEV_URL}/apis/v1/rest/projects/${repoName}/referencedata
154154

155155
rdListJson=$(curl --location --request GET ${PROJECT_REF_DATA_LIST_URL} \
156156
--header 'Content-Type: application/json' \
157157
--header 'Accept: application/json' \
158158
-u ${admin_user}:${admin_password})
159-
160-
rdListExport=$(echo "$rdListJson" | jq -r -c '.integration.serviceData.referenceData[].name // empty')
159+
160+
rdListExport=$(echo "$rdListJson" | jq -r -c '.output[].name // empty')
161161

162162
if [ -z "$rdListExport" ]; then
163163
echo "No reference data defined for the project"
164164
else
165-
for item in $(jq -r '.integration.serviceData.referenceData[] | .name' <<< "$rdListJson"); do
165+
for item in $(jq -r '.output[] | .name' <<< "$rdListJson"); do
166166
echod "Inside Ref Data Loop:" "$item"
167167
rdName=${item}
168168
exportSingleReferenceData ${LOCAL_DEV_URL} ${admin_user} ${admin_password} ${repoName} ${rdName} ${assetType} ${HOME_DIR} ${projectID}

pipelines/scripts/github/initializeRepo.sh

+12-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ function echod(){
6868

6969

7070
name=$(curl -u ${repo_user}:${PAT} https://api.github.com/repos/${repo_user}/${repoName} | jq -r '.name')
71+
repoid=$(curl -u ${repo_user}:${PAT} https://api.github.com/repos/${repo_user}/${repoName} | jq -r '.id')
7172
echo ${name}
7273
if [ "$name" == null ]
7374
then
@@ -77,6 +78,7 @@ name=$(curl -u ${repo_user}:${PAT} https://api.github.com/repos/${repo_user}/${r
7778

7879
#### Create empty repo & SECRET
7980
curl -u ${repo_user}:${PAT} https://api.github.com/user/repos -d '{"name":"'${repoName}'"}'
81+
repoid=$(curl -u ${repo_user}:${PAT} https://api.github.com/repos/${repo_user}/${repoName} | jq -r '.id')
8082

8183
keyJson=$(curl -u ${repo_user}:${PAT} --location --request GET https://api.github.com/repos/${repo_user}/${repoName}/actions/secrets/public-key \
8284
--header 'X-GitHub-Api-Version: 2022-11-28' \
@@ -127,11 +129,20 @@ name=$(curl -u ${repo_user}:${PAT} https://api.github.com/repos/${repo_user}/${r
127129
git commit -m "first commit"
128130
git push -u origin ${featureBranchName}
129131

132+
133+
134+
#Enable Actions
135+
curl -u ${repo_user}:${PAT} -L -X PUT \
136+
-H "Accept: application/vnd.github+json" \
137+
-H "X-GitHub-Api-Version: 2022-11-28" \
138+
https://api.github.com/orgs/${repo_user}/actions/permissions/repositories/${repoid}
139+
130140
#Enable workflow
131-
curl -u ${repo_user}:${PAT} -X PUT \
141+
curl -u ${repo_user}:${PAT} -L -X PUT \
132142
-H "Accept: application/vnd.github+json" \
133143
-H "X-GitHub-Api-Version: 2022-11-28" \
134144
https://api.github.com/repos/${repo_user}/${repoName}/actions/workflows/dev.yml/enable
145+
135146

136147
echo "Repo creation done !!!"
137148
else

pipelines/scripts/importAsset.sh

+13-50
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#############################################################################
44
# #
5-
# importAsset.sh : Import asset into a project #
5+
# importAsset.sh : Import asset into a project #
66
# #
77
#############################################################################
88

@@ -187,26 +187,29 @@ function importSingleRefData(){
187187
FILE=./${source_type}.csv
188188
formKey="file=@"${FILE}
189189
echod ${formKey}
190-
REF_DATA_URL=${LOCAL_DEV_URL}/integration/rest/external/v1/ut-flow/referencedata/${projectID}/${refDataName}
190+
REF_DATA_URL=${LOCAL_DEV_URL}/apis/v1/rest/projects/${repoName}/referencedata/${refDataName}
191+
191192
rdJson=$(curl --location --request GET ${REF_DATA_URL} \
192193
--header 'Content-Type: application/json' \
193194
--header 'Accept: application/json' \
194195
-u ${admin_user}:${admin_password})
195-
rdExport=$(echo "$rdJson" | jq '.integration.serviceData.referenceData // empty')
196+
rdExport=$(echo "$rdJson" | jq '.output // empty')
196197
if [ -z "$rdExport" ]; then
197198
echo "Refrence Data does not exists, Creating ....:" ${refDataName}
198-
POST_REF_DATA_URL=${LOCAL_DEV_URL}/integration/rest/external/v1/ut-flow/referencedata/create/${projectID}
199+
POST_REF_DATA_URL=${LOCAL_DEV_URL}/apis/v1/rest/projects/${repoName}/referencedata
200+
method="POST"
199201
else
200202
echo "Refrence Data exists, Updating ....:" ${refDataName}
201-
POST_REF_DATA_URL=${LOCAL_DEV_URL}/integration/rest/external/v1/ut-flow/referencedata/update/${projectID}/${refDataName}
203+
POST_REF_DATA_URL=${LOCAL_DEV_URL}/apis/v1/rest/projects/${repoName}/referencedata/${refDataName}
204+
method="PUT"
202205
fi
203-
projectPostJson=$(curl --location --request POST ${POST_REF_DATA_URL} \
206+
projectPostJson=$(curl --location --request ${method} ${POST_REF_DATA_URL} \
204207
--header 'Accept: application/json' \
205208
--form 'name='"$refDataName" \
206209
--form 'description='"$description" \
207-
--form 'field separator='"$columnDelimiter" \
208-
--form 'text qualifier='"$releaseCharacter" \
209-
--form 'file encoding='"$encodingType" \
210+
--form 'field_separator='"$columnDelimiter" \
211+
--form 'text_qualifier='"$releaseCharacter" \
212+
--form 'file_encoding='"$encodingType" \
210213
--form ${formKey} -u ${admin_user}:${admin_password})
211214
refDataOutput=$(echo "$projectPostJson" | jq -r -c '.integration.message.description')
212215
if [ "$refDataOutput"=="Success" ]; then
@@ -251,47 +254,7 @@ function importRefData(){
251254
echod "ProjectID:" ${projectID}
252255
cd ./assets/projectConfigs/referenceData/
253256
for d in * ; do
254-
importSingleRefData ${LOCAL_DEV_URL} ${admin_user} ${admin_password} ${repoName} ${d} ${assetType} ${HOME_DIR} ${synchProject} ${source_type} ${projectID}
255-
# if [ -d "$d" ]; then
256-
# refDataName="$d"
257-
# echod "$d"
258-
# cd "$d"
259-
# description=$(jq -r .description metadata.json)
260-
# columnDelimiter=$(jq -r .columnDelimiter metadata.json)
261-
# encodingType=$(jq -r .encodingType metadata.json)
262-
# releaseCharacter=$(jq -r .releaseCharacter metadata.json)
263-
# FILE=./${source_type}.csv
264-
# formKey="file=@"${FILE}
265-
# echod ${formKey}
266-
# REF_DATA_URL=${LOCAL_DEV_URL}/integration/rest/external/v1/ut-flow/referencedata/${projectID}/${refDataName}
267-
# rdJson=$(curl --location --request GET ${REF_DATA_URL} \
268-
# --header 'Content-Type: application/json' \
269-
# --header 'Accept: application/json' \
270-
# -u ${admin_user}:${admin_password})
271-
# rdExport=$(echo "$rdJson" | jq '.integration.serviceData.referenceData // empty')
272-
# if [ -z "$rdExport" ]; then
273-
# echo "Refrence Data does not exists, Creating ....:" ${refDataName}
274-
# POST_REF_DATA_URL=${LOCAL_DEV_URL}/integration/rest/external/v1/ut-flow/referencedata/create/${projectID}
275-
# else
276-
# echo "Refrence Data exists, Updating ....:" ${refDataName}
277-
# POST_REF_DATA_URL=${LOCAL_DEV_URL}/integration/rest/external/v1/ut-flow/referencedata/update/${projectID}/${refDataName}
278-
# fi
279-
# projectPostJson=$(curl --location --request POST ${POST_REF_DATA_URL} \
280-
# --header 'Accept: application/json' \
281-
# --form 'name='"$refDataName" \
282-
# --form 'description='"$description" \
283-
# --form 'field separator='"$columnDelimiter" \
284-
# --form 'text qualifier='"$releaseCharacter" \
285-
# --form 'file encoding='"$encodingType" \
286-
# --form ${formKey} -u ${admin_user}:${admin_password})
287-
# refDataOutput=$(echo "$projectPostJson" | jq -r -c '.integration.message.description')
288-
# if [ "$refDataOutput"=="Success" ]; then
289-
# echo "Reference Data created/updated successfully"
290-
# else
291-
# echo "Reference Data failed:" ${projectPostJson}
292-
# fi
293-
# cd -
294-
# fi
257+
importSingleRefData ${LOCAL_DEV_URL} ${admin_user} ${admin_password} ${repoName} ${d} ${assetType} ${HOME_DIR} ${synchProject} ${source_type} ${projectID}-
295258
done
296259
fi
297260
cd ${HOME_DIR}/${repoName}
2.85 MB
Binary file not shown.

0 commit comments

Comments
 (0)