Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into nate.patch.relative-paths
Browse files Browse the repository at this point in the history
  • Loading branch information
samiyaakhtar authored Apr 14, 2020
2 parents 2d561e2 + 24c4379 commit 886c1c9
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 7 deletions.
5 changes: 3 additions & 2 deletions docs/commands/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@
"arg": "--repository <repository>",
"description": "URL of the repository (SRC, HLD, Manifest)"
}
]
],
"markdown": "## Description\n\nThis command inserts data about pipeline runs into Azure Table storage.\n\n## Example\n\nThe following command has parameters for Azure Table storage credential and\nvarious pipelines run details.\n\n```\nspk deployment create -n $AZURE_STORAGE_ACCOUNT_NAME \\\n -k $AZURE_ACCOUNT_KEY \\\n -t $AZURE_TABLE_NAME \\\n -p $AZURE_TABLE_PARTITION_KEY \\\n --p2 $(Build.BuildId) \\\n --hld-commit-id $latest_commit \\\n --env $(Build.SourceBranchName) \\\n --image-tag $tag_name \\\n --pr $pr_id \\\n --repository $repourl\n```\n"
},
"deployment dashboard": {
"command": "dashboard",
Expand Down Expand Up @@ -237,7 +238,7 @@
"command": "append-variable-group <variable-group-name>",
"alias": "avg",
"description": "Appends the name of an existing variable group to the current manifest-generation.yaml file.",
"markdown": "## Description\n\nAppend a variable group name to the current `manifest-generation.yaml` of an\ninitialized hld repository.\n\n## Example\n\nWhen an HLD repository is first initialized with `spk hld init`, the top portion\nof the `manifest-generation.yaml` looks like this:\n\n```yaml\n# GENERATED WITH SPK VERSION 0.5.8\ntrigger:\n branches:\n include:\n - master\nvariables: []\npool:\n vmImage: ubuntu-latest\nsteps:\n.\n.\n.\n```\n\nrunning `spk hld append-variable-group my-vg` with a variable group name, in\nthis case `my-vg`, will add it under the `variables` section if it does not\nalready exist:\n\n```yaml\n# GENERATED WITH SPK VERSION 0.5.8\ntrigger:\n branches:\n include:\n - master\nvariables:\n - group: my-variable-group\npool:\n vmImage: ubuntu-latest\nsteps:\n.\n.\n.\n```\n"
"markdown": "## Description\n\nAppend a variable group name to the current `manifest-generation.yaml` of an\ninitialized hld repository.\n\n## Example\n\nWhen an HLD repository is first initialized with `spk hld init`, the top portion\nof the `manifest-generation.yaml` looks like this:\n\n```yaml\ntrigger:\n branches:\n include:\n - master\nvariables: []\npool:\n vmImage: ubuntu-latest\nsteps:\n.\n.\n.\n```\n\nrunning `spk hld append-variable-group my-vg` with a variable group name, in\nthis case `my-vg`, will add it under the `variables` section if it does not\nalready exist:\n\n```yaml\ntrigger:\n branches:\n include:\n - master\nvariables:\n - group: my-variable-group\npool:\n vmImage: ubuntu-latest\nsteps:\n.\n.\n.\n```\n"
},
"hld init": {
"command": "init",
Expand Down
43 changes: 43 additions & 0 deletions src/commands/deployment/create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## Description

This command inserts data about pipeline runs into Azure Table storage.

## Example

The following command has parameters for Azure Table storage credential and various pipelines run details. It's used by the source build pipeline, the release stage and the manifest generation pipeline, and each of them pass in parameters depending on the information for that pipeline. Here are three examples:

```
spk deployment create -n $AZURE_STORAGE_ACCOUNT_NAME \
-k $AZURE_ACCOUNT_KEY \
-t $AZURE_TABLE_NAME \
-p $AZURE_TABLE_PARTITION_KEY \
--p1 $(Build.BuildId) \
--image-tag $tag_name \
--commit-id $commitId \
--service $service \
--repository $repourl
```

```
spk deployment create -n $AZURE_STORAGE_ACCOUNT_NAME \
-k $AZURE_ACCOUNT_KEY \
-t $AZURE_TABLE_NAME \
-p $AZURE_TABLE_PARTITION_KEY \
--p2 $(Build.BuildId) \
--hld-commit-id $latest_commit \
--env $(Build.SourceBranchName) \
--image-tag $tag_name \
--pr $pr_id \
--repository $repourl
```

```
spk deployment create -n $AZURE_STORAGE_ACCOUNT_NAME \
-k $AZURE_ACCOUNT_KEY \
-t $AZURE_TABLE_NAME \
-p $AZURE_TABLE_PARTITION_KEY \
--p3 $(Build.BuildId) \
--hld-commit-id $commitId \
--pr $pr_id \
--repository $repourl
```
2 changes: 0 additions & 2 deletions src/commands/hld/append-variable-group.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ When an HLD repository is first initialized with `spk hld init`, the top portion
of the `manifest-generation.yaml` looks like this:

```yaml
# GENERATED WITH SPK VERSION 0.5.8
trigger:
branches:
include:
Expand All @@ -28,7 +27,6 @@ this case `my-vg`, will add it under the `variables` section if it does not
already exist:

```yaml
# GENERATED WITH SPK VERSION 0.5.8
trigger:
branches:
include:
Expand Down
8 changes: 5 additions & 3 deletions tests/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -532,11 +532,13 @@ function approve_pull_request () {

pr_exists=$(echo $all_prs | sed 's/\\r\\n//g' | jq -r --arg pr_title "$pr_title" '.[].title | select(startswith($pr_title)) != null')
if [ "$pr_exists" != "true" ]; then
echo "PR for '$pr_title' not found"
exit 1
if [ $pr_exists != *"true"* ]; then
echo "PR for '$pr_title' not found"
exit 1
fi
fi
real_title=$(echo $all_prs | jq -r --arg pr_title "$pr_title" 'select(.[].title | startswith($pr_title)) | .[].title' | head -n 1)
pull_request_id=$(echo $all_prs | jq -r --arg pr_title "$pr_title" 'select(.[].title | startswith($pr_title)) | .[0].pullRequestId')
pull_request_id=$(echo $all_prs | jq -r --arg pr_title "$pr_title" 'select(.[0].title | startswith($pr_title)) | .[0].pullRequestId')
echo "Found pull request starting with phrase '$pr_title'"
echo "Pull request id $pull_request_id is '$real_title'"

Expand Down

0 comments on commit 886c1c9

Please sign in to comment.