Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Ambassadors/CNCFInsertAmbassadorInPeople_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ def process_entries(firstLine, lastLine):

# Insert new person in sorted order
indexPeople = 0
inserted = False
for people in data:
if people["name"].lower() < newPerson.name.lower():
indexPeople += 1
Expand All @@ -290,8 +291,15 @@ def process_entries(firstLine, lastLine):
data.insert(indexPeople, json.JSONDecoder(object_pairs_hook=OrderedDict).decode(newPerson.toJSON()))
split_tup = os.path.splitext(newPerson.image)
os.rename("imageTemp" + split_tup[1], "../../people/images/" + newPerson.image)
inserted = True
break

if not inserted:
# Append to end if new name sorts after all existing entries
data.append(json.JSONDecoder(object_pairs_hook=OrderedDict).decode(newPerson.toJSON()))
split_tup = os.path.splitext(newPerson.image)
os.rename("imageTemp" + split_tup[1], "../../people/images/" + newPerson.image)

# Write updated data back to file
with open(PEOPLE_JSON_PATH, "w", encoding='utf-8') as jsonfile:
json.dump(data, jsonfile, indent=3, ensure_ascii=False, sort_keys=False)
Expand Down
22 changes: 10 additions & 12 deletions Kubestronaut/CNCFInsertKubestronautInPeople_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,22 +176,20 @@ def ack_kubestronaut(email):
if (peopleFound == True) :
print(newPeople.toJSON())

indexPeople=0
for people in data:
if people["name"].lower() == newPeople.name.lower():
print("{newPeople.name} already in people.json, abort !")
exit(2)
else:
print('Adding '+newPeople.name)
data.insert(0, json.JSONDecoder(object_pairs_hook=OrderedDict).decode(newPeople.toJSON()))
os.rename("imageTemp.jpg", "../../people/images/"+newPeople.image)
ack_kubestronaut(row[12])
break
# Check for existing entry first; add only if not present
if any(p["name"].lower() == newPeople.name.lower() for p in data):
print(f"{newPeople.name} already in people.json, abort !")
exit(2)

print('Adding ' + newPeople.name)
data.insert(0, json.JSONDecoder(object_pairs_hook=OrderedDict).decode(newPeople.toJSON()))
os.rename("imageTemp.jpg", "../../people/images/" + newPeople.image)
ack_kubestronaut(row[12])

sorted_people = sorted(data, key=lambda x: x['name'])

with open('../../people/people.json', "w", encoding='utf-8') as jsonfile:
jsonfile.write(json.dumps(data, indent=4, ensure_ascii=False))
jsonfile.write(json.dumps(sorted_people, indent=4, ensure_ascii=False))

if NON_acked_Kubestronauts:
print("\n\nList of Kubestroauts that were NOT ACKED:")
Expand Down
9 changes: 6 additions & 3 deletions Kubestronaut/Rendering/GenerateWorldTimelapseCartopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,13 @@ def color_country(country):
world['color'] = world['ADMIN'].apply(color_country)

# Plot the countries with the specified color
world.plot(ax=ax, color=world['color'], edgecolor='black', transform=ccrs.Robinson(), alpha=0.8)
world.plot(ax=ax, color=world['color'], edgecolor='black', transform=ccrs.PlateCarree(), alpha=0.8)

# Add the OpenStreetMap basemap underneath the countries to give depth
cx.add_basemap(ax, crs=ccrs.Robinson().proj4_init, source=cx.providers.OpenStreetMap.Mapnik)
# Try to add a basemap for context; if unavailable, continue without it
try:
cx.add_basemap(ax, source=cx.providers.OpenStreetMap.Mapnik)
except Exception:
pass

# Clear any previous text to avoid overlap and re-render fresh text
fig.texts.clear()
Expand Down
20 changes: 14 additions & 6 deletions utilities/labeler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"os"
"path/filepath"
"slices"
"strconv"
"strings"

"github.com/google/go-github/v55/github"
Expand Down Expand Up @@ -95,15 +96,18 @@ func main() {
flag.Parse()

if len(flag.Args()) < 5 {
fmt.Println("Usage: labeler [flags] <labels_url> <owner> <repo> <issue_number> <comment_body> <changed_files>")
fmt.Println("Usage: labeler [flags] <labels_url> <owner> <repo> <issue_number> <comment_body> [changed_files]")
os.Exit(1)
}
labelsURL := flag.Arg(0)
owner := flag.Arg(1)
repo := flag.Arg(2)
issueNum := flag.Arg(3)
commentBody := flag.Arg(4)
changedFiles := flag.Arg(5)
var changedFiles string
if len(flag.Args()) >= 6 {
changedFiles = flag.Arg(5)
}

if labelsURL == "" {
log.Fatal("labels URL not set")
Expand Down Expand Up @@ -210,6 +214,12 @@ func main() {
*/
if len(rule.Spec.MatchList) > 0 {
// Validate argv.0 against matchList
if len(argv) == 0 {
if cfg.Debug {
log.Printf("No argument provided for command %s to validate against matchList", rule.Spec.Command)
}
continue
}
valid := slices.Contains(rule.Spec.MatchList, argv[0])
if !valid {
log.Printf("Invalid argument `%s` for command %s", argv[0], rule.Spec.Command)
Expand Down Expand Up @@ -453,11 +463,9 @@ func removeLabel(ctx context.Context, client *github.Client, owner, repo string,
}

func toInt(s string) int {
n, err := fmt.Sscanf(s, "%d", new(int))
if err != nil || n != 1 {
i, err := strconv.Atoi(strings.TrimSpace(s))
if err != nil {
log.Fatalf("invalid issue number: %s", s)
}
var i int
fmt.Sscanf(s, "%d", &i)
return i
}
Loading