Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(GC/azure): fix Azure VM deletion by changing timeCreated to createdTime #1596

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

smerle33
Copy link
Contributor

@smerle33 smerle33 commented Dec 11, 2024

ref: jenkins-infra/helpdesk#4445

a az resource show show that the field existing is createdTime but not timeCreated, but I cannot find trace of that change on azure

{
  "changedTime": "2024-12-11T14:24:00.478990+00:00",
  "createdTime": "2024-12-11T14:24:00.452248+00:00",
  "extendedLocation": null,
  "id": "/subscriptions/<redacted>/resourceGroups/DEV-PACKER-BUILDS/providers/Microsoft.Compute/disks/pkrosmq3gtdonba",
  "identity": null,
  "kind": null,
  "location": "eastus2",
  "managedBy": "/subscriptions/<redacted>/resourceGroups/dev-packer-builds/providers/Microsoft.Compute/virtualMachines/pkrvmmq3gtdonba",
  "name": "pkrosmq3gtdonba",
  "plan": null,
  "properties": null,
  "provisioningState": "Succeeded",
  "resourceGroup": "DEV-PACKER-BUILDS",
  "sku": {
    "capacity": null,
    "family": null,
    "model": null,
    "name": "Standard_LRS",
    "size": null,
    "tier": "Standard"
  },
  "tags": {
    "build_type": "dev",
    "imageplatform": "amd64",
    "scm_ref": "9895aea21814bbccac18563c5a519232be8a5fe8",
    "timestamp": "20241211142322",
    "version": "0.1596.1"
  },
  "type": "Microsoft.Compute/disks"
}

if I select with timeCreated: az resource list --resource-group=dev-packer-builds | jq -r '.[] | select(.timeCreated < ("2024-12-10")) | .id'
it return data even if 20241210 is yesterday :

az resource list --resource-group=dev-packer-builds | jq -r '.[] | select(.timeCreated < ("2024-12-10")) | .id'
/subscriptions/1311c09f-aee0-4d6c-99a4-392c2b543204/resourceGroups/DEV-PACKER-BUILDS/providers/Microsoft.Compute/disks/pkrosvrf05jjl6v
/subscriptions/1311c09f-aee0-4d6c-99a4-392c2b543204/resourceGroups/DEV-PACKER-BUILDS/providers/Microsoft.Compute/disks/pkros0a6rph6dsq

if I select with createdTime: az resource list --resource-group=dev-packer-builds | jq -r '.[] | select(.createdTime < ("2024-12-10")) | .id'
it's empty which is correct.

if I tried with a date in the future: az resource list --resource-group=dev-packer-builds | jq -r '.[] | select(.createdTime < ("2024-12-12")) | .id'
it doest return object from todays builds:

...
/subscriptions/1311c09f-aee0-4d6c-99a4-392c2b543204/resourceGroups/DEV-PACKER-BUILDS/providers/Microsoft.Compute/disks/pkros67wgux1mp3
/subscriptions/1311c09f-aee0-4d6c-99a4-392c2b543204/resourceGroups/dev-packer-builds/providers/Microsoft.Network/networkInterfaces/pkrninzsxr39yye
/subscriptions/1311c09f-aee0-4d6c-99a4-392c2b543204/resourceGroups/dev-packer-builds/providers/Microsoft.Compute/virtualMachines/pkrvmnzsxr39yye
...
Capture d’écran 2024-12-11 à 16 54 18

@smerle33 smerle33 changed the title fix(GC/azure): change timeCreated to createdTime chore(GC/azure): change timeCreated to createdTime Dec 11, 2024
@dduportal dduportal changed the title chore(GC/azure): change timeCreated to createdTime chore(GC/azure): fix Azure VM deletion by changing timeCreated to createdTime Dec 11, 2024
@dduportal dduportal merged commit b25c739 into jenkins-infra:main Dec 11, 2024
2 checks passed
smerle33 added a commit that referenced this pull request Dec 12, 2024
not needed anymore following #1596
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants