Post grafana dashboard to particular folder - grafana

I am trying to use the grafana API to post dashboards to a specific folder. Using the following command, I can see the folder ID's for all folders in my grafana:
curl -X GET http://<username>:<password>#localhost:3000/api/folders?limit=200
[{"id":9,"uid":"6m0M3AZZk","title":"Apps"},{"id":38,"uid":"jEJ5aSVZz","title":"Cluster_Health"},{"id":31,"uid":"vsmJ2dGZz","title":"CPU by App"},{"id":51,"uid":"Fx9ajQXWz","title":"Data Pipeline"},{"id":6,"uid":"dYFMMhZWz","title":"home"},{"id":19,"uid":"qDwG6yWZz","title":"Node_Health"},{"id":18,"uid":"37pWeyWZk","title":"Pending_Data"},{"id":44,"uid":"nreWbxfWz","title":"Prod"},{"id":13,"uid":"PYzEBYZWk","title":"Services"},{"id":27,"uid":"byVe4IMWk","title":"API"}]
Now, I would like to post a dashboard to my Services folder (id 13). However, when I make my request, this dashboard is always going to the General folder. I am using a python script to make my request:
def post_dashboard(filepath):
with open(filepath, "r") as fin:
data = json.loads(fin.read())
data = json.dumps(data)
response = requests.post("http://localhost:3000/api/dashboards/db", headers=headers_raw, data=data)
print(response.json())
print(response.status_code)
My JSON file looks like this:
{"dashboard": {
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": null,
"iteration": 1593098750052,
"links": [],
"panels": [
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus-1",
"description": "The amount of CPU taken up by redis from top command",
"fill": 0,
"gridPos": {
"h": 8,
"w": 24,
"x": 0,
"y": 0
},
"id": 10,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "app_cpu{node_type=\"process\", cluster_id=~\"$cluster\", app_name=~\".*redisserver.*\"}",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "{{ host_name }}",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "CPU Used",
"tooltip": {
"shared": true,
"sort": 2,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus-1",
"description": "The current amount of memory redis is consuming",
"fill": 0,
"gridPos": {
"h": 9,
"w": 12,
"x": 0,
"y": 8
},
"id": 2,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "redis_mem_used{cluster_id=~\"$cluster\"}",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "{{ node }}",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Redis Memory Used",
"tooltip": {
"shared": true,
"sort": 2,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "decbytes",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus-1",
"description": "The maximum amount of memory that redis has used",
"fill": 0,
"gridPos": {
"h": 9,
"w": 12,
"x": 12,
"y": 8
},
"id": 4,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "redis_mem_peak{cluster_id=~\"$cluster\"}",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "{{ node }}",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Redis Peak Memory",
"tooltip": {
"shared": true,
"sort": 2,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "decbytes",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus-1",
"description": "The amount of memory used by the LUA engine inside of redis",
"fill": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 17
},
"id": 6,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "redis_mem_lua{cluster_id=~\"$cluster\"}",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "{{ node }}",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "LUA Mem Used",
"tooltip": {
"shared": true,
"sort": 2,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "decbytes",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus-1",
"description": "The amount of memory used as observed by top",
"fill": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 17
},
"id": 8,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "redis_mem_rss{cluster_id=~\"$cluster\"}",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "{{ node }}",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "RSS Mem Used",
"tooltip": {
"shared": true,
"sort": 2,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "decbytes",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
}
],
"schemaVersion": 18,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"allValue": null,
"current": {},
"datasource": "Prometheus-1",
"definition": "label_values(redis_mem_used, cluster_id)",
"hide": 0,
"includeAll": true,
"label": null,
"multi": true,
"name": "cluster",
"options": [],
"query": "label_values(redis_mem_used, cluster_id)",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
}
]
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
]
},
"timezone": "",
"title": "Redis",
"uid": "rfdsk32",
"folder": "Services",
"folderTitle": "Services",
"folderId": 13,
"overwrite": true
}
}
My grafana version is 6.2.0. I have used several references that say that folderId should be the controlling keyword for which folder a dashboard goes to.
https://grafana.com/docs/grafana/latest/http_api/dashboard/#create-update-dashboard

You have used wrong payload structure:
{
"dashboard": {
...
"folderId": 13,
"overwrite": true
}
}
Correct structure is:
{
"dashboard": {
...
},
"folderId": 13,
"overwrite": true
}

Related

How to add json data in ConfigMap creation in ArgoCD

I'm trying to create a ConfigMap with ArgoCD.
I've created a volumes.yaml file as such
---
apiVersion: v1
kind: ConfigMap
metadata:
name: persistent-volumes-argo
labels:
grafana_dashboard: "1"
project: "foo"
data:
kubernetes.json: |
{{ .Files.Get "dashboards/persistent-volumes.json" | indent 4 }}
But ArgoCD doesn't seem to be able to read the data, the way a standard Helm deployment would.
I've tried adding the data directly into the ConfigMap as such
(Data omitted for brevity)
---
apiVersion: v1
kind: ConfigMap
metadata:
name: persistent-volumes-argo
labels:
grafana_dashboard: "1"
project: "foo"
data:
kubernetes.json: |
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"limit": 100,
"name": "Annotations & Alerts",
"showIn": 0,
"type": "dashboard"
}
]
},
"editable": true,
"gnetId": 13646,
"graphTooltip": 0,
"iteration": 1659421503107,
"links": [],
"panels": [
{
"collapsed": false,
"datasource": null,
"fieldConfig": {
"defaults": {},
"overrides": []
},
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 0
},
"id": 26,
"panels": [],
"title": "Alerts",
"type": "row"
},
{
"datasource": "$datasource",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"noValue": "--",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "semi-dark-red",
"value": null
},
{
"color": "light-green",
"value": -0.0001
},
{
"color": "semi-dark-red",
"value": 0.0001
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 8,
"x": 0,
"y": 1
},
"id": 21,
"options": {
"colorMode": "background",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.0.3",
"targets": [
{
"expr": "count (max by (persistentvolumeclaim,namespace) (kubelet_volume_stats_used_bytes{namespace=~\"${k8s_namespace}\"} ) and (max by (persistentvolumeclaim,namespace) (kubelet_volume_stats_used_bytes{namespace=~\"${k8s_namespace}\"} )) / (max by (persistentvolumeclaim,namespace) (kubelet_volume_stats_capacity_bytes{namespace=~\"${k8s_namespace}\"} )) >= (${warning_threshold} / 100)) or vector (0)",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "PVCs Above Warning Threshold",
"type": "stat"
},
{
"datasource": "$datasource",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"decimals": 0,
"mappings": [],
"noValue": "--",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "semi-dark-red",
"value": null
},
{
"color": "light-green",
"value": -0.0001
},
{
"color": "semi-dark-red",
"value": 0.0001
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 8,
"x": 8,
"y": 1
},
"id": 24,
"options": {
"colorMode": "background",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.0.3",
"targets": [
{
"expr": "count((kube_persistentvolumeclaim_status_phase{namespace=~\"${k8s_namespace}\",phase=\"Pending\"}==1)) or vector(0)",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "PVCs in Pending State",
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "stat"
},
{
"datasource": "$datasource",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"decimals": 0,
"mappings": [],
"noValue": "--",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "semi-dark-red",
"value": null
},
{
"color": "light-green",
"value": -0.0001
},
{
"color": "semi-dark-red",
"value": 0.0001
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 8,
"x": 16,
"y": 1
},
"id": 23,
"options": {
"colorMode": "background",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.0.3",
"targets": [
{
"expr": "count((kube_persistentvolumeclaim_status_phase{namespace=~\"${k8s_namespace}\",phase=\"Lost\"}==1)) or vector(0)",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "PVCs in Lost State",
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "stat"
},
{
"collapsed": false,
"datasource": null,
"fieldConfig": {
"defaults": {},
"overrides": []
},
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 5
},
"id": 17,
"panels": [],
"title": "Usage statistics",
"type": "row"
},
{
"datasource": "$datasource",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": null,
"displayMode": "auto",
"filterable": false
},
"mappings": [],
"noValue": "--",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "light-green",
"value": null
}
]
},
"unit": "none"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Used (%)"
},
"properties": [
{
"id": "custom.displayMode",
"value": "gradient-gauge"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "light-green",
"value": null
},
{
"color": "semi-dark-yellow",
"value": 70
},
{
"color": "dark-red",
"value": 80
}
]
}
},
{
"id": "decimals",
"value": 1
}
]
},
{
"matcher": {
"id": "byName",
"options": "Status"
},
"properties": [
{
"id": "custom.displayMode",
"value": "color-background"
},
{
"id": "mappings",
"value": [
{
"options": {
"0": {
"text": "Bound"
},
"1": {
"text": "Pending"
},
"2": {
"text": "Lost"
}
},
"type": "value"
}
]
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "light-green",
"value": null
},
{
"color": "light-green",
"value": 0
},
{
"color": "semi-dark-orange",
"value": 1
},
{
"color": "semi-dark-red",
"value": 2
}
]
}
},
{
"id": "noValue",
"value": "--"
},
{
"id": "custom.align",
"value": "center"
}
]
},
{
"matcher": {
"id": "byName",
"options": "Namespace"
},
"properties": [
{
"id": "custom.width",
"value": 120
}
]
},
{
"matcher": {
"id": "byName",
"options": "Status"
},
"properties": [
{
"id": "custom.width",
"value": 80
}
]
},
{
"matcher": {
"id": "byName",
"options": "Capacity (GiB)"
},
"properties": [
{
"id": "custom.width",
"value": 120
}
]
},
{
"matcher": {
"id": "byName",
"options": "Used (GiB)"
},
"properties": [
{
"id": "custom.width",
"value": 120
}
]
},
{
"matcher": {
"id": "byName",
"options": "Available (GiB)"
},
"properties": [
{
"id": "custom.width",
"value": 120
}
]
},
{
"matcher": {
"id": "byName",
"options": "StorageClass"
},
"properties": [
{
"id": "custom.width",
"value": 150
}
]
},
{
"matcher": {
"id": "byName",
"options": "PersistentVolumeClaim"
},
"properties": [
{
"id": "custom.width",
"value": 370
}
]
}
]
},
"gridPos": {
"h": 12,
"w": 24,
"x": 0,
"y": 6
},
"id": 29,
"interval": "",
"options": {
"frameIndex": 2,
"showHeader": true,
"sortBy": [
{
"desc": false,
"displayName": "PersistentVolumeClaim"
}
]
},
"pluginVersion": "8.0.3",
"targets": [
{
"expr": " sum by (persistentvolumeclaim,namespace,storageclass,volumename) (kube_persistentvolumeclaim_info{namespace=~\"${k8s_namespace}\"})",
"format": "table",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "A"
},
{
"expr": "sum by (persistentvolumeclaim) (kubelet_volume_stats_capacity_bytes{namespace=~\"${k8s_namespace}\"}/1024/1024/1024)",
"format": "table",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "B"
},
{
"expr": "sum by (persistentvolumeclaim) (kubelet_volume_stats_used_bytes{namespace=~\"${k8s_namespace}\"}/1024/1024/1024)",
"format": "table",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "C"
},
{
"expr": "sum by (persistentvolumeclaim) (kubelet_volume_stats_available_bytes{namespace=~\"${k8s_namespace}\"}/1024/1024/1024)",
"format": "table",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "D"
},
{
"expr": "sum(kube_persistentvolumeclaim_status_phase{namespace=~\"${k8s_namespace}\",phase=~\"(Pending|Lost)\"}) by (persistentvolumeclaim) + sum(kube_persistentvolumeclaim_status_phase{namespace=~\"${k8s_namespace}\",phase=~\"(Lost)\"}) by (persistentvolumeclaim)",
"format": "table",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "E"
},
{
"expr": "sum by (persistentvolumeclaim) (kubelet_volume_stats_used_bytes{namespace=~\"${k8s_namespace}\"}/kubelet_volume_stats_capacity_bytes{namespace=~\"${k8s_namespace}\"} * 100)",
"format": "table",
"instant": true,
"interval": "",
"legendFormat": "",
"refId": "F"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Persistent Volume Claim",
"transformations": [
{
"id": "seriesToColumns",
"options": {
"byField": "persistentvolumeclaim"
}
},
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"Time 1": true,
"Time 2": true,
"Time 3": true,
"Time 4": true,
"Time 5": true,
"Time 6": true,
"Value #A": true
},
"indexByName": {},
"renameByName": {
"Time 1": "",
"Time 2": "",
"Time 3": "",
"Time 4": "",
"Time 5": "",
"Time 6": "",
"Value #A": "",
"Value #B": "Capacity (GiB)",
"Value #C": "Used (GiB)",
"Value #D": "Available (GiB)",
"Value #E": "Status",
"Value #F": "Used (%)",
"namespace": "Namespace",
"persistentvolumeclaim": "PersistentVolumeClaim",
"storageclass": "StorageClass",
"volumename": "PhysicalVolume"
}
}
}
],
"type": "table"
},
{
"datasource": "$datasource",
"fieldConfig": {
"defaults": {
"custom": {
"align": null,
"displayMode": "auto",
"filterable": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 5,
"w": 24,
"x": 0,
"y": 18
},
"id": 7,
"options": {
"showHeader": true,
"sortBy": [
{
"desc": true,
"displayName": "Status"
}
]
},
"pluginVersion": "8.0.3",
"targets": [
{
"expr": "kube_storageclass_info",
"format": "table",
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Storage Class",
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"Value": true,
"__name__": true,
"app_kubernetes_io_instance": true,
"app_kubernetes_io_name": true,
"instance": true,
"job": true,
"kubernetes_namespace": true,
"kubernetes_pod_name": true,
"pod_template_hash": true
},
"indexByName": {
"Time": 1,
"Value": 13,
"__name__": 2,
"app_kubernetes_io_instance": 3,
"app_kubernetes_io_name": 4,
"instance": 5,
"job": 6,
"kubernetes_namespace": 7,
"kubernetes_pod_name": 8,
"pod_template_hash": 9,
"provisioner": 10,
"reclaimPolicy": 11,
"storageclass": 0,
"volumeBindingMode": 12
},
"renameByName": {
"provisioner": "Provisioner",
"reclaimPolicy": "ReclaimPolicy",
"storageclass": "StorageClass",
"volumeBindingMode": "VolumeBindingMode"
}
}
},
{
"id": "groupBy",
"options": {
"fields": {
"Provisioner": {
"aggregations": [],
"operation": "groupby"
},
"ReclaimPolicy": {
"aggregations": [],
"operation": "groupby"
},
"StorageClass": {
"aggregations": [],
"operation": "groupby"
},
"VolumeBindingMode": {
"aggregations": [],
"operation": "groupby"
}
}
}
}
],
"type": "table"
},
{
"collapsed": false,
"datasource": null,
"fieldConfig": {
"defaults": {},
"overrides": []
},
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 23
},
"id": 15,
"panels": [],
"title": "Graphical usage data ",
"type": "row"
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "$datasource",
"fill": 0,
"fillGradient": 0,
"gridPos": {
"h": 12,
"w": 24,
"x": 0,
"y": 24
},
"hiddenSeries": false,
"id": 9,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": true,
"min": true,
"rightSide": true,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "8.0.3",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "(max by (persistentvolumeclaim,namespace) (kubelet_volume_stats_used_bytes{namespace=~\"${k8s_namespace}\"}))",
"interval": "",
"legendFormat": "{{namespace}} ({{persistentvolumeclaim}})",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "All Running PVCs Used Bytes",
"tooltip": {
"shared": true,
"sort": 2,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "bytes",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "Date & time",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"collapsed": true,
"datasource": null,
"fieldConfig": {
"defaults": {},
"overrides": []
},
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 36
},
"id": 19,
"panels": [
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "$datasource",
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 0,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 41
},
"hiddenSeries": false,
"id": 11,
"legend": {
"alignAsTable": true,
"avg": true,
"current": false,
"max": false,
"min": false,
"rightSide": true,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.2.1",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "rate(kubelet_volume_stats_used_bytes{namespace=~\"${k8s_namespace}\"}[1h])",
"instant": false,
"interval": "",
"legendFormat": "{{namespace}} ({{persistentvolumeclaim}})",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Hourly Volume Usage Rate",
"tooltip": {
"shared": true,
"sort": 2,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "binBps",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "Date & time",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "$datasource",
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 0,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 48
},
"hiddenSeries": false,
"id": 12,
"legend": {
"alignAsTable": true,
"avg": true,
"current": false,
"max": false,
"min": false,
"rightSide": true,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.2.1",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "rate(kubelet_volume_stats_used_bytes{namespace=~\"${k8s_namespace}\"}[1d])",
"interval": "",
"legendFormat": "{{namespace}} ({{persistentvolumeclaim}})",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Daily Volume Usage Rate",
"tooltip": {
"shared": true,
"sort": 2,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "binBps",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "Date & time",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "$datasource",
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 0,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 55
},
"hiddenSeries": false,
"id": 13,
"legend": {
"alignAsTable": true,
"avg": true,
"current": false,
"max": false,
"min": false,
"rightSide": true,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
}
}
But this errors with rpc error: code = FailedPrecondition desc = Failed to unmarshal "volumes.yaml": <nil>
Is there a way to pass in json data when creating a ConfigMap with ArgoCD, either as a template or by dumping the data in the file?
To create configmap with argocd and helm
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "helm-chart.fullname" . }}-configmap
data:
config.json : |
{{ toJson .Values.configmap | indent 4 }}
and the value file should be like this, which is our JSON but converted to YAML
configmap:
json:
- rigid
- better for data interchange
yaml:
- slim and flexible
- better for configuration
object:
key: value
array:
- null_value:
- boolean: true
- integer: 1
- alias: &example aliases are like variables
- alias: *example
paragraph: >
Blank lines denote
paragraph breaks
content: |-
Or we
can auto
convert line breaks
to save space
alias: &foo
bar: baz
alias_reuse: *foo
json2yaml
A complete demo app can be found here
A very quick way to create app with the above configmap and demo app
argocd app create demo-app --repo https://github.com/Adiii717/argocd-demo-app.git --path helm-chart --dest-namespace default --dest-server https://kubernetes.default.svc --helm-set replicaCount=2
Make sure you also set
export ARGOCD_AUTH_TOKEN="tokeh
export ARGOCD_OPTS="--grpc-web"
export ARGOCD_SERVER="argocd.example.com"
added section for the configmap

Grafana 8 | Notifications Alert

We did an upgrade to our Loki-stack from version:2.1.0 to version 2.4.1, After the upgrade Grafana Alert Rules are not working previously we were running version: 6.7 of Grafana, and now we running version:8.0. In the dashboard am getting the below error.
Error:
Checking the logs on Grafana pod am getting the below error.
t=2022-05-11T13:16:12+0000 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=user1 method=GET path=/api/prometheus/grafana/api/v1/rules status=404 remote_addr=159.12.0.4 time_ms=2 size=29 referer="https://digisc.dev.company.com/internal/grafana/d/k8s_views_global/kubernetes-views-global-version-8-grafana?orgId=1&refresh=30s"
t=2022-05-11T13:30:57+0000 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=user1 method=GET path=/api/alertmanager/grafana/config/api/v1/alerts status=404 remote_addr=159.12.0.4 time_ms=9 size=29 referer=https://digisc.dev.campany.com/internal/grafana/alerting/notifications
In the browser console am getting below error.
https://digisc.dev.company.com/internal/grafana/api/ruler/1/api/v1/rules 500
We used helm to release our infrastructure changes.
Below is one of the alerts we used::
{
"alert": {
"alertRuleTags": {},
"conditions": [
{
"evaluator": {
"params": [
15
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"params": [
"C",
"5m",
"now"
]
},
"reducer": {
"params": [],
"type": "last"
},
"type": "query"
}
],
"executionErrorState": "alerting",
"for": "5m",
"frequency": "1m",
"handler": 1,
"name": "Cluster CPU Capacity alert",
"noDataState": "ok",
"notifications": []
},
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus",
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 5,
"w": 6,
"x": 6,
"y": 9
},
"hiddenSeries": false,
"id": 10,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "sum(kube_node_status_capacity_cpu_cores)",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "allocatable",
"refId": "A"
},
{
"expr": "sum(kube_node_status_allocatable_cpu_cores)",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "capacity",
"refId": "B"
},
{
"expr": "sum(kube_pod_container_resource_requests_cpu_cores)",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "requested",
"refId": "C"
}
],
"thresholds": [
{
"colorMode": "critical",
"fill": true,
"line": true,
"op": "gt",
"value": 15
}
],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Cluster CPU Capacity",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"decimals": null,
"format": "none",
"label": "cores",
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
}
Can you please assist if you are familiar with this error maybe we missed a configuration during the upgrade?
We used below helm chart for Loki::
https://github.com/grafana/helm-charts/tree/main/charts/loki-stack

How to get all the files from the Moodle assignment in a course?

I want to get all the files from an assignment in Moodle. Is there a way to get all the files?
When I call core_course_get_contents from my local Moodle instance as
http://localhost:8077/webservice/rest/server.php?wstoken=11e2d8b7f8e21ca1804e41e9cac5a816&wsfunction=core_course_get_contents&courseid=4&moodlewsrestformat=json
I receive the response as:
[
{
"id": 22,
"name": "General",
"visible": 1,
"summary": "",
"summaryformat": 1,
"section": 0,
"hiddenbynumsections": 0,
"uservisible": true,
"modules": []
},
{
"id": 23,
"name": "Introduction",
"visible": 1,
"summary": "",
"summaryformat": 1,
"section": 1,
"hiddenbynumsections": 0,
"uservisible": true,
"modules": [
{
"id": 44,
"url": "http://localhost:8077/mod/assign/view.php?id=44",
"name": "Assignment",
"instance": 3,
"contextid": 99,
"visible": 1,
"uservisible": true,
"visibleoncoursepage": 1,
"modicon": "http://localhost:8077/theme/image.php/boost/assign/1613571924/icon",
"modname": "assign",
"modplural": "Assignments",
"indent": 0,
"onclick": "",
"afterlink": null,
"customdata": "\"\"",
"noviewlink": false,
"completion": 1,
"completiondata": {
"state": 0,
"timecompleted": 0,
"overrideby": null,
"valueused": false
}
},
{
"id": 46,
"url": "http://localhost:8077/mod/resource/view.php?id=46",
"name": "test(.txt)",
"instance": 24,
"contextid": 102,
"visible": 1,
"uservisible": true,
"visibleoncoursepage": 1,
"modicon": "http://localhost:8077/theme/image.php/boost/core/1613571924/f/text-24",
"modname": "resource",
"modplural": "Files",
"indent": 0,
"onclick": "",
"afterlink": null,
"customdata": "\"a:1:{s:10:\\\"printintro\\\";i:1;}\"",
"noviewlink": false,
"completion": 1,
"completiondata": {
"state": 0,
"timecompleted": 0,
"overrideby": null,
"valueused": false
},
"contents": [
{
"type": "file",
"filename": "test.txt",
"filepath": "/",
"filesize": 935,
"fileurl": "http://localhost:8077/webservice/pluginfile.php/102/mod_resource/content/1/test.txt?forcedownload=1",
"timecreated": 1621949734,
"timemodified": 1621949744,
"sortorder": 1,
"mimetype": "text/plain",
"isexternalfile": false,
"userid": 2,
"author": "ABC",
"license": "unknown"
}
],
"contentsinfo": {
"filescount": 1,
"filessize": 935,
"lastmodified": 1621949744,
"mimetypes": [
"text/plain"
],
"repositorytype": ""
}
}
]
}
]
I want to get the files from the assignment. Is there a way to achieve this?

Commit Status not working with Continuous Deployment Trigger in Azure Release via API

We have an Azure Repository which triggers a Release-Pipeline every time something is pushed to the main branch.
When a Release is triggered it shows its status (succeeded) on the right side in the commits in Azure Repos like on the following Picture:
It even shows which stage is already promoted etc. which is awesome. This all works fine when configuring the Release Pipeline Manually with the following CD-Trigger Configuration:
Even when exporting the Pipeline JSON file and reimporting it everything works as expected.
However, when creating the Release with the exact same Settings via API i don't see the Status of the Release. The trigger itself works as expected but the status in the commits is simply not there:
Does someone know which exact Setting in the Release-Pipeline.json is responsible for this status?
Here are some parts of the json body I send via API which might be missing something?
Edit: A few more information needed i guess. I use a cli-tool to create the body and send the api request. The values are templated.
The template gets its values either from previous api calls or from user inputs. Here is the complete template. I created it based on the manually configured relase-pipeline JSON (Which works fine and shows the status i want).
{
"name": "{{.BuildProjectName}}/{{.BuildServiceName}}",
"path": "\\",
"isDeleted": false,
"source": "restApi",
"releaseNameFormat": "{{.BuildServiceName}}-$(rev:r)",
"properties": {
"DefinitionCreationSource": {
"$type": "System.String",
"$value": "ReleaseNew"
},
"IntegrateBoardsWorkItems": {
"$type": "System.String",
"$value": "False"
},
"IntegrateJiraWorkItems": {
"$type": "System.String",
"$value": "false"
}
},
"artifacts": [
{
"sourceId": "{{.BuildProjectID}}:{{.BuildRepoID}}",
"type": "Git",
"alias": "BuildRepo",
"definitionReference": {
"branches": {
"id": "{{.BuildRepoDefaultBranch}}",
"name": "{{.BuildRepoDefaultBranch}}"
},
"checkoutNestedSubmodules": {
"id": "True",
"name": "Any nested submodules within"
},
"defaultVersionType": {
"id": "latestFromBranchType",
"name": "Latest from the default branch"
},
"definition": {
"id": "{{.BuildRepoID}}",
"name": "{{.BuildServiceName}}"
},
"project": {
"id": "{{.BuildProjectID}}",
"name": "{{.BuildProjectName}}"
}
},
"isPrimary": true,
"isRetained": false
},
{
"type": "Git",
"alias": "FluxDeployScript",
"definitionReference": {
"branches": {
"id": "master",
"name": "master"
},
"checkoutNestedSubmodules": {
"id": "True",
"name": "Any nested submodules within"
},
"defaultVersionType": {
"id": "latestFromBranchType",
"name": "Latest from the default branch"
},
"definition": {
"id": "black-washed",
"name": "azure-pipeline-templates"
},
"project": {
"id": "black-washed",
"name": "Operations"
}
},
"isRetained": false
},
{
"type": "Build",
"alias": "BuildPipeline",
"definitionReference": {
"defaultVersionType": {
"id": "latestType",
"name": "Latest"
},
"definition": {
"id": "{{.BuildPipelineID}}",
"name": "{{.BuildServiceName}}"
},
"IsMultiDefinitionType": {
"id": "False",
"name": "False"
},
"project": {
"id": "{{.BuildProjectID}}",
"name": "{{.BuildProjectName}}"
}
},
"isRetained": false
}
],
"environments": [
{
"name": "dev",
"rank": 1,
"conditions": [
{
"name": "ReleaseStarted",
"conditionType": 1,
"value": ""
}
],
"deployPhases": [
{
"rank": 1,
"phaseType": 1,
"name": "Agent job",
"refName": null,
"deploymentInput": {
"queueId": "{{.QueueID}}",
"agentSpecification": {
"identifier": "ubuntu-20.04"
}
},
"workflowTasks": [
{
"environment": {},
"taskId": "2a6ca863-f2ce-4f4d-8bcb-15e64608ec4b",
"version": "1.*",
"name": "Download flux creds",
"refName": "fluxCreds",
"enabled": true,
"alwaysRun": false,
"continueOnError": false,
"timeoutInMinutes": 0,
"definitionType": "task",
"overrideInputs": {},
"condition": "succeeded()",
"inputs": {
"secureFile": "black-washed",
"retryCount": "8",
"socketTimeout": ""
}
},
{
"environment": {
"USER_EMAIL": "{{.ApproverMail}}",
"ENVIRONMENT": "$(Release.EnvironmentName)",
"DESCRIPTION": "$(Release.ReleaseDescription)",
"URL": "$(Release.ReleaseWebURL)",
"PROJECT": "{{.BuildProjectName}}",
"CONTAINER": "{{.BuildServiceName}}",
"TAG": "$(Release.Artifacts.BuildPipeline.BuildNumber)",
"REPOSITORY": "finodigital.azurecr.io",
"WORKLOAD_TYPE": "deployment",
"NAMESPACE": "{{.BuildProjectName}}",
"WORKLOAD_NAME": "{{.BuildProjectName}}-{{.BuildServiceName}}",
"USER_NAME": "{{.ApproverName}}",
"FLUX_CREDS": "$(fluxCreds.secureFilePath)"
},
"taskId": "6c731c3c-3c68-459a-a5c9-bde6e6595b5b",
"version": "3.*",
"name": "Bash Script",
"refName": "",
"enabled": true,
"alwaysRun": false,
"continueOnError": false,
"timeoutInMinutes": 0,
"definitionType": "task",
"overrideInputs": {},
"condition": "succeeded()",
"inputs": {
"targetType": "filePath",
"filePath": "$(System.DefaultWorkingDirectory)/FluxDeployScript/flux-release.sh",
"arguments": "",
"workingDirectory": "",
"failOnStderr": "false",
"noProfile": "true",
"noRc": "true"
}
}
]
}
],
"retentionPolicy": {
"daysToKeep": 30,
"releasesToKeep": 3,
"retainBuild": true
},
"preDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": true,
"isNotificationOn": false
}
],
"approvalOptions": {
"requiredApproverCount": null,
"releaseCreatorCanBeApprover": false,
"autoTriggeredAndPreviousEnvironmentApprovedCanBeSkipped": false,
"enforceIdentityRevalidation": false,
"timeoutInMinutes": 0,
"executionOrder": 1
}
},
"postDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": true,
"isNotificationOn": false
}
],
"approvalOptions": {
"requiredApproverCount": null,
"releaseCreatorCanBeApprover": false,
"autoTriggeredAndPreviousEnvironmentApprovedCanBeSkipped": false,
"enforceIdentityRevalidation": false,
"timeoutInMinutes": 0,
"executionOrder": 2
}
}
},
{
"name": "test",
"rank": 2,
"conditions": [
{
"name": "dev",
"conditionType": 2,
"value": "4"
}
],
"deployPhases": [
{
"rank": 1,
"phaseType": 1,
"name": "Agent job",
"refName": null,
"deploymentInput": {
"queueId": "{{.QueueID}}",
"agentSpecification": {
"identifier": "ubuntu-20.04"
}
},
"workflowTasks": [
{
"environment": {},
"taskId": "2a6ca863-f2ce-4f4d-8bcb-15e64608ec4b",
"version": "1.*",
"name": "Download flux creds",
"refName": "fluxCreds",
"enabled": true,
"alwaysRun": false,
"continueOnError": false,
"timeoutInMinutes": 0,
"definitionType": "task",
"overrideInputs": {},
"condition": "succeeded()",
"inputs": {
"secureFile": "black-washed",
"retryCount": "8",
"socketTimeout": ""
}
},
{
"environment": {
"USER_EMAIL": "{{.ApproverMail}}",
"ENVIRONMENT": "$(Release.EnvironmentName)",
"DESCRIPTION": "$(Release.ReleaseDescription)",
"URL": "$(Release.ReleaseWebURL)",
"PROJECT": "{{.BuildProjectName}}",
"CONTAINER": "{{.BuildServiceName}}",
"TAG": "$(Release.Artifacts.BuildPipeline.BuildNumber)",
"REPOSITORY": "finodigital.azurecr.io",
"WORKLOAD_TYPE": "deployment",
"NAMESPACE": "{{.BuildProjectName}}",
"WORKLOAD_NAME": "{{.BuildProjectName}}-{{.BuildServiceName}}",
"USER_NAME": "{{.ApproverName}}",
"FLUX_CREDS": "$(fluxCreds.secureFilePath)"
},
"taskId": "6c731c3c-3c68-459a-a5c9-bde6e6595b5b",
"version": "3.*",
"name": "Bash Script",
"refName": "",
"enabled": true,
"alwaysRun": false,
"continueOnError": false,
"timeoutInMinutes": 0,
"definitionType": "task",
"overrideInputs": {},
"condition": "succeeded()",
"inputs": {
"targetType": "filePath",
"filePath": "$(System.DefaultWorkingDirectory)/FluxDeployScript/flux-release.sh",
"arguments": "",
"workingDirectory": "",
"failOnStderr": "false",
"noProfile": "true",
"noRc": "true"
}
}
]
}
],
"retentionPolicy": {
"daysToKeep": 30,
"releasesToKeep": 3,
"retainBuild": true
},
"preDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": false,
"isNotificationOn": false,
"approver": {
"displayName": null,
"id": "{{.ApproverID}}"
}
}
],
"approvalOptions": {
"requiredApproverCount": null,
"releaseCreatorCanBeApprover": false,
"autoTriggeredAndPreviousEnvironmentApprovedCanBeSkipped": false,
"enforceIdentityRevalidation": false,
"timeoutInMinutes": 0,
"executionOrder": 1
}
},
"postDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": true,
"isNotificationOn": false
}
],
"approvalOptions": {
"requiredApproverCount": null,
"releaseCreatorCanBeApprover": false,
"autoTriggeredAndPreviousEnvironmentApprovedCanBeSkipped": false,
"enforceIdentityRevalidation": false,
"timeoutInMinutes": 0,
"executionOrder": 2
}
}
},
{
"name": "prod",
"rank": 3,
"conditions": [
{
"name": "test",
"conditionType": 2,
"value": "4"
}
],
"deployPhases": [
{
"rank": 1,
"phaseType": 1,
"name": "Agent job",
"refName": null,
"deploymentInput": {
"queueId": "{{.QueueID}}",
"agentSpecification": {
"identifier": "ubuntu-20.04"
}
},
"workflowTasks": [
{
"environment": {},
"taskId": "2a6ca863-f2ce-4f4d-8bcb-15e64608ec4b",
"version": "1.*",
"name": "Download flux creds",
"refName": "fluxCreds",
"enabled": true,
"alwaysRun": false,
"continueOnError": false,
"timeoutInMinutes": 0,
"definitionType": "task",
"overrideInputs": {},
"condition": "succeeded()",
"inputs": {
"secureFile": "black-wahsed",
"retryCount": "8",
"socketTimeout": ""
}
},
{
"environment": {
"USER_EMAIL": "{{.ApproverMail}}",
"ENVIRONMENT": "$(Release.EnvironmentName)",
"DESCRIPTION": "$(Release.ReleaseDescription)",
"URL": "$(Release.ReleaseWebURL)",
"PROJECT": "{{.BuildProjectName}}",
"CONTAINER": "{{.BuildServiceName}}",
"TAG": "$(Release.Artifacts.BuildPipeline.BuildNumber)",
"REPOSITORY": "finodigital.azurecr.io",
"WORKLOAD_TYPE": "deployment",
"NAMESPACE": "{{.BuildProjectName}}",
"WORKLOAD_NAME": "{{.BuildProjectName}}-{{.BuildServiceName}}",
"USER_NAME": "{{.ApproverName}}",
"FLUX_CREDS": "$(fluxCreds.secureFilePath)"
},
"taskId": "6c731c3c-3c68-459a-a5c9-bde6e6595b5b",
"version": "3.*",
"name": "Bash Script",
"refName": "",
"enabled": true,
"alwaysRun": false,
"continueOnError": false,
"timeoutInMinutes": 0,
"definitionType": "task",
"overrideInputs": {},
"condition": "succeeded()",
"inputs": {
"targetType": "filePath",
"filePath": "$(System.DefaultWorkingDirectory)/FluxDeployScript/flux-release.sh",
"arguments": "",
"workingDirectory": "",
"failOnStderr": "false",
"noProfile": "true",
"noRc": "true"
}
}
]
}
],
"retentionPolicy": {
"daysToKeep": 30,
"releasesToKeep": 3,
"retainBuild": true
},
"preDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": false,
"isNotificationOn": false,
"approver": {
"displayName": null,
"id": "{{.ApproverID}}"
}
}
],
"approvalOptions": {
"requiredApproverCount": null,
"releaseCreatorCanBeApprover": false,
"autoTriggeredAndPreviousEnvironmentApprovedCanBeSkipped": false,
"enforceIdentityRevalidation": false,
"timeoutInMinutes": 0,
"executionOrder": 1
}
},
"postDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": true,
"isNotificationOn": false
}
],
"approvalOptions": {
"requiredApproverCount": null,
"releaseCreatorCanBeApprover": false,
"autoTriggeredAndPreviousEnvironmentApprovedCanBeSkipped": false,
"enforceIdentityRevalidation": false,
"timeoutInMinutes": 0,
"executionOrder": 2
}
}
}
],
"triggers": [
{
"branchFilters": [
"{{.BuildRepoDefaultBranch}}"
],
"alias": "BuildRepo",
"triggerType": 3
}
]
According to your description, I tested it and everything works as expected.
Steps:
Get the release definition via the REST API Definitions - Get and copy the response body.
GET https://vsrm.dev.azure.com/{organization}/{project}/_apis/release/definitions/{definitionId}?api-version=6.1-preview.4
Create the new release pipeline via the REST API Definitions - Create
POST https://vsrm.dev.azure.com/{organization}/{project}/_apis/release/definitions?api-version=6.1-preview.4
Copy the response body and rename the field name to New release pipeline2, then mark it as request body.
I am using PostMan.
Result:
Update1
It seems that you are missing the field environmentOptions field in the request body, which contains publishDeploymentStatus, which controls the feature you are missing.
If you do not configure it or set the value to false, you will not see the Status of the Release in the commit page.
"environmentOptions": {
"emailNotificationType": "OnlyOnFailure",
"emailRecipients": "release.environment.owner;release.creator",
"skipArtifactsDownload": false,
"timeoutInMinutes": 0,
"enableAccessToken": false,
"publishDeploymentStatus": false,
"badgeEnabled": false,
"autoLinkWorkItems": false,
"pullRequestDeploymentEnabled": false
},
Result:

Cytoscape Dijkstra Algorithm off?

I'm trying to use Cytoscape to test Dijkstra's algorithm on various graphs. Using the graph below
It's easy to see that the shortest path from A to C would be A -> D -> E -> C.
When running Cytoscape's Djikstra's algorithm though
const dijkstra = cy.elements().dijkstra('#A', function(){
const weight = this.data('weight');
return weight;
}, false);
const pathToC = dijkstra.pathTo( cy.$('#C') );
const distToC = dijkstra.distanceTo( cy.$('#C') );
Cytoscape gives the output
A -> B -> C
which is definitely wrong.
Am I doing something wrong? Or is Cytoscape's algorithm off?
PS Code to generate the graph in Cytoscape is
{
"elements": {
"nodes": [
{
"data": {
"id": "A"
},
"position": {
"x": 187,
"y": 135
},
"group": "nodes",
"removed": false,
"selected": false,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
},
{
"data": {
"id": "B"
},
"position": {
"x": 516,
"y": 128
},
"group": "nodes",
"removed": false,
"selected": false,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
},
{
"data": {
"id": "C"
},
"position": {
"x": 726,
"y": 302
},
"group": "nodes",
"removed": false,
"selected": false,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
},
{
"data": {
"id": "D"
},
"position": {
"x": 186,
"y": 447
},
"group": "nodes",
"removed": false,
"selected": false,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
},
{
"data": {
"id": "E"
},
"position": {
"x": 510,
"y": 445
},
"group": "nodes",
"removed": false,
"selected": false,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
}
],
"edges": [
{
"data": {
"id": "BA",
"source": "B",
"target": "A",
"weight": "100"
},
"position": {
"x": 514,
"y": 127
},
"group": "edges",
"removed": false,
"selected": true,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
},
{
"data": {
"id": "DA",
"source": "D",
"target": "A",
"weight": "1"
},
"position": {
"x": 187,
"y": 446
},
"group": "edges",
"removed": false,
"selected": false,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
},
{
"data": {
"id": "BD",
"source": "B",
"target": "D",
"weight": "100"
},
"position": {
"x": 516,
"y": 127
},
"group": "edges",
"removed": false,
"selected": false,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
},
{
"data": {
"id": "EB",
"source": "E",
"target": "B",
"weight": "100"
},
"position": {
"x": 500,
"y": 442
},
"group": "edges",
"removed": false,
"selected": false,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
},
{
"data": {
"id": "ED",
"source": "E",
"target": "D",
"weight": "1"
},
"position": {
"x": 501,
"y": 443
},
"group": "edges",
"removed": false,
"selected": false,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
},
{
"data": {
"id": "CE",
"source": "C",
"target": "E",
"weight": "5"
},
"position": {
"x": 727,
"y": 304
},
"group": "edges",
"removed": false,
"selected": false,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
},
{
"data": {
"id": "BC",
"source": "B",
"target": "C",
"weight": "5"
},
"position": {
"x": 521,
"y": 132
},
"group": "edges",
"removed": false,
"selected": false,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
}
]
},
"style": [
{
"selector": "node",
"style": {
"background-color": "#666",
"label": "data(id)"
}
},
{
"selector": "edge",
"style": {
"width": "3px",
"label": "data(weight)",
"line-color": "#ccc",
"target-arrow-color": "#ccc",
"target-arrow-shape": "triangle"
}
}
],
"zoomingEnabled": true,
"userZoomingEnabled": true,
"zoom": 1,
"minZoom": 1.0e-50,
"maxZoom": 1.0e+50,
"panningEnabled": true,
"userPanningEnabled": true,
"pan": {
"x": 0,
"y": 0
},
"boxSelectionEnabled": true,
"renderer": {
"name": "canvas"
}
}
I'm having the same issue, pretty much same code.
Done some debugging, looks like the dist object is concatenating strings rather than adding integers.
dist: Object
AMS11: "0474483" -> 0, 4, 74, 483 should really be 561
BRU11: Infinity
FRA11: Infinity
GVA11: Infinity
LON11: "0474" -> 0, 4, 74 should really be 78
LON21: 0
LON22: "04" -> 0, 4 should really be 4
LON31: "047415" -> 0, 4, 74, 15 should really be 93
LUX21: Infinity
LUX31: Infinity
MOW11: Infinity
MOW12: Infinity
PAR11: "049693"
PAR21: "0474805"
STO21: Infinity
STO31: Infinity
TYO11: Infinity
TYO12: Infinity
Edit: Answer is to change your weights to integers so use "weight": 1 instead of "weight": "1".