This repository has been archived by the owner on Jun 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Example: Gh action comment output (#21)
* WIP: Add print statements for debugging. Signed-off-by: Szymon Duchniewicz <[email protected]> * Add calculate_iac_carbon.yml and example data Signed-off-by: Szymon Duchniewicz <[email protected]> * Update calculate_iac_carbon.yml * WIP: adding github comment output for the action. Signed-off-by: Szymon Duchniewicz <[email protected]> * WIP: temporarily change target github action for carbon measure. Signed-off-by: Szymon Duchniewicz <[email protected]> * WIP: add another comment print variable. Signed-off-by: Szymon Duchniewicz <[email protected]> * Update calculate_iac_carbon.yml and action.yml * Update action.yml: remove temporary prints Signed-off-by: Szymon Duchniewicz <[email protected]> * refactor(gh-action): clean up comments and test prints Signed-off-by: Szymon Duchniewicz <[email protected]> * Point comment workflow to GSF repo Dev branch. Clean up action.yml. Signed-off-by: Szymon Duchniewicz <[email protected]> * Clarification: Current unit is in lbs co2eq/kWh. Signed-off-by: Szymon Duchniewicz <[email protected]> * Samples: Add samples directory. * Add carbon-ci-pipeline-demo guide. Signed-off-by: Szymon Duchniewicz <[email protected]> * Samples: GH Action: Fix guide. Signed-off-by: Szymon Duchniewicz <[email protected]> --------- Signed-off-by: Szymon Duchniewicz <[email protected]>
- Loading branch information
Showing
3 changed files
with
459 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Calculate Carbon | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- Dev | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
carbon-measure: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.17 | ||
- name: Set and check goenv | ||
run: | | ||
go env -w GO111MODULE=on | ||
go version && go env | ||
- id: carbon_output | ||
uses: Green-Software-Foundation/Carbon_CI_Pipeline_Tooling@Dev | ||
with: | ||
IACFile: $GITHUB_WORKSPACE/data/azuredeploy.json | ||
IACType: arm | ||
CloudProvider: azure | ||
CARBON_RATE_PROVIDER: watttime | ||
env: | ||
ELECTRICITY_MAP_AUTH_TOKEN: ${{ secrets.ELECTRICITY_MAP_AUTH_TOKEN }} | ||
WATT_TIME_USER: ${{ secrets.WATT_TIME_USER }} | ||
WATT_TIME_PASS: ${{ secrets.WATT_TIME_PASS }} | ||
|
||
- name: Create comment | ||
uses: peter-evans/create-or-update-comment@v2 | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body: | | ||
pounds carbon equivalent per MWh = ${{ steps.carbon_output.outputs.grams_carbon_equivalent_per_kwh }} | ||
pounds co2 emitted over 24h = ${{ steps.carbon_output.outputs.grams_emitted_over_24h }} | ||
reactions: rocket | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,345 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | ||
"contentVersion": "1.0.0.0", | ||
"parameters": {}, | ||
"resources": [ | ||
{ | ||
"type": "Microsoft.Compute/virtualMachines", | ||
"apiVersion": "2022-03-01", | ||
"name": "TestVM", | ||
"location": "eastus", | ||
"tags": { | ||
"tagName1": "tagValue1", | ||
"tagName2": "tagValue2" | ||
}, | ||
"identity": { | ||
"type": "string", | ||
"userAssignedIdentities": {} | ||
}, | ||
"plan": { | ||
"name": "string", | ||
"product": "string", | ||
"promotionCode": "string", | ||
"publisher": "string" | ||
}, | ||
"properties": { | ||
"additionalCapabilities": { | ||
"hibernationEnabled": "bool", | ||
"ultraSSDEnabled": "bool" | ||
}, | ||
"applicationProfile": { | ||
"galleryApplications": [ | ||
{ | ||
"configurationReference": "string", | ||
"enableAutomaticUpgrade": "bool", | ||
"order": "int", | ||
"packageReferenceId": "string", | ||
"tags": "string", | ||
"treatFailureAsDeploymentFailure": "bool" | ||
} | ||
] | ||
}, | ||
"availabilitySet": { | ||
"id": "string" | ||
}, | ||
"billingProfile": { | ||
"maxPrice": "int" | ||
}, | ||
"capacityReservation": { | ||
"capacityReservationGroup": { | ||
"id": "string" | ||
} | ||
}, | ||
"diagnosticsProfile": { | ||
"bootDiagnostics": { | ||
"enabled": "bool", | ||
"storageUri": "string" | ||
} | ||
}, | ||
"evictionPolicy": "string", | ||
"extensionsTimeBudget": "string", | ||
"hardwareProfile": { | ||
"vmSize": "Standard_A2_V2", | ||
"vmSizeProperties": { | ||
"vCPUsAvailable": "int", | ||
"vCPUsPerCore": "int" | ||
} | ||
}, | ||
"host": { | ||
"id": "string" | ||
}, | ||
"hostGroup": { | ||
"id": "string" | ||
}, | ||
"licenseType": "string", | ||
"networkProfile": { | ||
"networkApiVersion": "2020-11-01", | ||
"networkInterfaceConfigurations": [ | ||
{ | ||
"name": "string", | ||
"properties": { | ||
"deleteOption": "string", | ||
"dnsSettings": { | ||
"dnsServers": [ "string" ] | ||
}, | ||
"dscpConfiguration": { | ||
"id": "string" | ||
}, | ||
"enableAcceleratedNetworking": "bool", | ||
"enableFpga": "bool", | ||
"enableIPForwarding": "bool", | ||
"ipConfigurations": [ | ||
{ | ||
"name": "string", | ||
"properties": { | ||
"applicationGatewayBackendAddressPools": [ | ||
{ | ||
"id": "string" | ||
} | ||
], | ||
"applicationSecurityGroups": [ | ||
{ | ||
"id": "string" | ||
} | ||
], | ||
"loadBalancerBackendAddressPools": [ | ||
{ | ||
"id": "string" | ||
} | ||
], | ||
"primary": "bool", | ||
"privateIPAddressVersion": "string", | ||
"publicIPAddressConfiguration": { | ||
"name": "string", | ||
"properties": { | ||
"deleteOption": "string", | ||
"dnsSettings": { | ||
"domainNameLabel": "string" | ||
}, | ||
"idleTimeoutInMinutes": "int", | ||
"ipTags": [ | ||
{ | ||
"ipTagType": "string", | ||
"tag": "string" | ||
} | ||
], | ||
"publicIPAddressVersion": "string", | ||
"publicIPAllocationMethod": "string", | ||
"publicIPPrefix": { | ||
"id": "string" | ||
} | ||
}, | ||
"sku": { | ||
"name": "Standard_A2_V2", | ||
"tier": "Standard" | ||
} | ||
}, | ||
"subnet": { | ||
"id": "string" | ||
} | ||
} | ||
} | ||
], | ||
"networkSecurityGroup": { | ||
"id": "string" | ||
}, | ||
"primary": "bool" | ||
} | ||
} | ||
], | ||
"networkInterfaces": [ | ||
{ | ||
"id": "string", | ||
"properties": { | ||
"deleteOption": "string", | ||
"primary": "bool" | ||
} | ||
} | ||
] | ||
}, | ||
"osProfile": { | ||
"adminPassword": "string", | ||
"adminUsername": "string", | ||
"allowExtensionOperations": "bool", | ||
"computerName": "string", | ||
"customData": "string", | ||
"linuxConfiguration": { | ||
"disablePasswordAuthentication": "bool", | ||
"patchSettings": { | ||
"assessmentMode": "string", | ||
"automaticByPlatformSettings": { | ||
"rebootSetting": "string" | ||
}, | ||
"patchMode": "string" | ||
}, | ||
"provisionVMAgent": "bool", | ||
"ssh": { | ||
"publicKeys": [ | ||
{ | ||
"keyData": "string", | ||
"path": "string" | ||
} | ||
] | ||
} | ||
}, | ||
"requireGuestProvisionSignal": "bool", | ||
"secrets": [ | ||
{ | ||
"sourceVault": { | ||
"id": "string" | ||
}, | ||
"vaultCertificates": [ | ||
{ | ||
"certificateStore": "string", | ||
"certificateUrl": "string" | ||
} | ||
] | ||
} | ||
], | ||
"windowsConfiguration": { | ||
"additionalUnattendContent": [ | ||
{ | ||
"componentName": "Microsoft-Windows-Shell-Setup", | ||
"content": "string", | ||
"passName": "OobeSystem", | ||
"settingName": "string" | ||
} | ||
], | ||
"enableAutomaticUpdates": "bool", | ||
"patchSettings": { | ||
"assessmentMode": "string", | ||
"automaticByPlatformSettings": { | ||
"rebootSetting": "string" | ||
}, | ||
"enableHotpatching": "bool", | ||
"patchMode": "string" | ||
}, | ||
"provisionVMAgent": "bool", | ||
"timeZone": "string", | ||
"winRM": { | ||
"listeners": [ | ||
{ | ||
"certificateUrl": "string", | ||
"protocol": "string" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"platformFaultDomain": "int", | ||
"priority": "string", | ||
"proximityPlacementGroup": { | ||
"id": "string" | ||
}, | ||
"scheduledEventsProfile": { | ||
"terminateNotificationProfile": { | ||
"enable": "bool", | ||
"notBeforeTimeout": "string" | ||
} | ||
}, | ||
"securityProfile": { | ||
"encryptionAtHost": "bool", | ||
"securityType": "string", | ||
"uefiSettings": { | ||
"secureBootEnabled": "bool", | ||
"vTpmEnabled": "bool" | ||
} | ||
}, | ||
"storageProfile": { | ||
"dataDisks": [ | ||
{ | ||
"createOption": "string", | ||
"deleteOption": "string", | ||
"detachOption": "ForceDetach", | ||
"diskSizeGB": "int", | ||
"image": { | ||
"uri": "string" | ||
}, | ||
"lun": "int", | ||
"managedDisk": { | ||
"diskEncryptionSet": { | ||
"id": "string" | ||
}, | ||
"id": "string", | ||
"securityProfile": { | ||
"diskEncryptionSet": { | ||
"id": "string" | ||
}, | ||
"securityEncryptionType": "string" | ||
}, | ||
"storageAccountType": "string" | ||
}, | ||
"name": "string", | ||
"toBeDetached": "bool", | ||
"vhd": { | ||
"uri": "string" | ||
}, | ||
"writeAcceleratorEnabled": "bool" | ||
} | ||
], | ||
"imageReference": { | ||
"communityGalleryImageId": "string", | ||
"id": "string", | ||
"offer": "string", | ||
"publisher": "string", | ||
"sharedGalleryImageId": "string", | ||
"sku": "string", | ||
"version": "string" | ||
}, | ||
"osDisk": { | ||
"createOption": "string", | ||
"deleteOption": "string", | ||
"diffDiskSettings": { | ||
"option": "Local", | ||
"placement": "string" | ||
}, | ||
"diskSizeGB": "int", | ||
"encryptionSettings": { | ||
"diskEncryptionKey": { | ||
"secretUrl": "string", | ||
"sourceVault": { | ||
"id": "string" | ||
} | ||
}, | ||
"enabled": "bool", | ||
"keyEncryptionKey": { | ||
"keyUrl": "string", | ||
"sourceVault": { | ||
"id": "string" | ||
} | ||
} | ||
}, | ||
"image": { | ||
"uri": "string" | ||
}, | ||
"managedDisk": { | ||
"diskEncryptionSet": { | ||
"id": "string" | ||
}, | ||
"id": "string", | ||
"securityProfile": { | ||
"diskEncryptionSet": { | ||
"id": "string" | ||
}, | ||
"securityEncryptionType": "string" | ||
}, | ||
"storageAccountType": "string" | ||
}, | ||
"name": "string", | ||
"osType": "string", | ||
"vhd": { | ||
"uri": "string" | ||
}, | ||
"writeAcceleratorEnabled": "bool" | ||
} | ||
}, | ||
"userData": "string", | ||
"virtualMachineScaleSet": { | ||
"id": "string" | ||
} | ||
}, | ||
"zones": [ "string" ] | ||
} | ||
], | ||
"outputs": {} | ||
} |
Oops, something went wrong.