Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/src/go_modules-403cefacee
Browse files Browse the repository at this point in the history
  • Loading branch information
cjlapao authored Nov 25, 2024
2 parents f46f66d + e0c1408 commit bd7f397
Show file tree
Hide file tree
Showing 71 changed files with 1,902 additions and 394 deletions.
4 changes: 1 addition & 3 deletions .github/ISSUE_TEMPLATE/product-backlog-item.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ body:
- [ ] **Criterion 1**: Detailed description of the first acceptance criterion.
description: |
Define the conditions that must be met for the item to be considered complete.
validations:
required: true
- type: checkboxes
id: definition_of_done
attributes:
Expand All @@ -59,7 +57,7 @@ body:
- type: textarea
id: dependencies
attributes:
label: Assumptions and Constraints
label: Dependencies
placeholder: |-
- **Dependency 1**: Detailed description of the first dependency.
- type: textarea
Expand Down
71 changes: 71 additions & 0 deletions .github/workflow_scripts/remove-docker-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/bash

MODE="UNKNOWN"
PATTERN=""
while [[ $# -gt 0 ]]; do
case $1 in
rm)
MODE="REMOVE"
shift
;;
ls)
MODE="LIST"
shift
;;
--pattern)
PATTERN=$2
shift
shift
;;
--filter)
PATTERN=$2
shift
shift
;;
*)
echo "Invalid argument: $1" >&2
exit 1
;;
esac
done

if [ "$MODE" == "UNKNOWN" ]; then
echo "You need to specify the mode (rm, ls) with the first argument"
exit 1
fi

if [ "$PATTERN" == "" ]; then
PATTERN=".*"
fi

function list() {
OUT=$(hub-tool tag ls cjlapao/prl-devops-service --format json)
LINES=$(echo "$OUT" | jq -r '.[].Name')
echo "$LINES" | while IFS= read -r line; do
if [[ $line =~ $PATTERN ]]; then
echo "$line"
fi
done
}

function remove() {
echo "WARNING: You are about to permanently delete images that match the pattern: $PATTERN"
echo " This action is irreversible"
read -r -p "Are you sure you want to continue? (yes/no): " confirm
if [ "$confirm" != "yes" ]; then
echo "Operation aborted."
exit 1
fi

lines=$(list)
echo "$lines" | while IFS= read -r line; do
echo "Deleting image $line"
hub-tool tag rm "$line" -f
done
}

if [ "$MODE" == "LIST" ]; then
list
elif [ "$MODE" == "REMOVE" ]; then
remove "$PATTERN"
fi
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
All notable changes to this project will be documented in this file.
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.9.12] - 2024-11-13

- Fix timeout for the apis and set the default to 5 hours
- Added more information to the orchestrator hosts endpoint
- Added a fix for the push copy file
- Added a fix in the uninstall of the root service to also clear the database file

## [0.9.11] - 2024-11-12

- Improved orchestrator timeouts
Expand Down
20 changes: 13 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# syntax=docker/dockerfile:1
############################
# STEP 1 build executable binary
############################
Expand All @@ -15,20 +16,25 @@ COPY ./src .
RUN go get -d -v

# Build the binary.
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o /go/bin/prl-devops-service
ARG BUILD_ENV=production
ARG VERSION
ARG OS=linux
ARG ARCHITECTURE=amd64

RUN --mount=type=secret,id=amplitude_api_key,env=AMPLITUDE_API_KEY

RUN if [ "$BUILD_ENV" = "production" ]; then \
CGO_ENABLED=0 GOOS=$OS GOARCH=$ARCHITECTURE go build -ldflags="-s -w -X main.ver=$VERSION -X 'github.com/Parallels/prl-devops-service/telemetry.AmplitudeApiKey=$AMPLITUDE_API_KEY'" -o /go/bin/prl-devops-service; \
else \
CGO_ENABLED=0 GOOS=$OS GOARCH=$ARCHITECTURE go build -ldflags="-s -w -X main.ver=$VERSION" -o /go/bin/prl-devops-service; \
fi

############################
# STEP 2 build a small image
############################
FROM alpine:latest

RUN apk update && apk add curl coreutils bash musl-utils ca-certificates
# Copy our static executable.
# COPY --from=builder /bin/cat /bin/cat
# COPY --from=builder /usr/bin/whoami /usr/bin/whoami
# COPY --from=builder /usr/bin/getent /usr/bin/getent
# COPY --from=builder /bin/uname /usr/bin/uname
# COPY --from=builder /usr/bin/id /usr/bin/id
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

COPY --from=builder /etc/ssl/certs/ca-certificates.crt /tmp/
Expand Down
52 changes: 43 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
NAME ?= prldevops
export PACKAGE_NAME ?= $(NAME)
export DOCKER_PACKAGE_NAME ?= "prl-devops-service"
ifeq ($(OS),Windows_NT)
export VERSION=$(shell type VERSION)
export VERSION:=$(shell type VERSION)
else
export VERSION=$(shell cat VERSION)
export VERSION:=$(shell cat VERSION)
export BUILD_ID:=$(shell date +%s)
export SHORT_VERSION:=$(shell echo $(VERSION) | cut -d'.' -f1,2)
export BUILD_VERSION:=$(shell echo $(SHORT_VERSION).$(BUILD_ID))
endif

COBERTURA = cobertura
Expand Down Expand Up @@ -104,15 +108,45 @@ endif
@cd src && CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o ../out/binaries/$(PACKAGE_NAME)-alpine
@echo "Build finished."

.PHONY: push-alpha-container
push-alpha-container:
@echo "Building $(BUILD_VERSION) Alpha Container..."
@docker build -t cjlapao/$(DOCKER_PACKAGE_NAME):$(BUILD_VERSION)_alpha \
-t cjlapao/$(DOCKER_PACKAGE_NAME):latest_alpha \
--build-arg VERSION=$(BUILD_VERSION) \
--build-arg BUILD_ENV=debug \
--build-arg OS=linux \
--build-arg ARCHITECTURE=amd64 \
-f Dockerfile .
@echo "Pushing $(BUILD_VERSION) Container..."
@echo "Pushing cjlapao/$(DOCKER_PACKAGE_NAME):$(BUILD_VERSION)_alpha tag..."
@docker push cjlapao/$(DOCKER_PACKAGE_NAME):$(BUILD_VERSION)_alpha
@echo "Pushing cjlapao/$(DOCKER_PACKAGE_NAME):latest_alpha tag..."
@docker push cjlapao/$(DOCKER_PACKAGE_NAME):latest_alpha
@echo "Build finished. Pushed to cjlapao/$(DOCKER_PACKAGE_NAME):$(BUILD_VERSION)_alpha and cjlapao/$(DOCKER_PACKAGE_NAME):latest_alpha."

.PHONY: clean-alpha
clean-alpha-container:
@echo "Removing all alpha versions from Docker Hub..."
@./.github/workflow_scripts/remove-docker-images.sh rm --filter '.*alpha.*$'
@echo "All alpha versions removed."

.PHONY: push-beta-container
push-beta-container:
@echo "Building..."
ifeq ($(wildcard ./out/.*),)
@echo "Creating out directory..."
@mkdir out
@mkdir out/binaries
endif
@echo "Build finished."
@echo "Building $(BUILD_VERSION) Beta Container..."
@docker build -t cjlapao/$(DOCKER_PACKAGE_NAME):$(BUILD_VERSION)_beta \
-t cjlapao/$(DOCKER_PACKAGE_NAME):unstable \
--build-arg VERSION=$(BUILD_VERSION) \
--build-arg BUILD_ENV=debug \
--build-arg OS=linux \
--build-arg ARCHITECTURE=amd64 \
-f Dockerfile .
@echo "Pushing $(BUILD_VERSION) Container..."
@echo "Pushing cjlapao/$(DOCKER_PACKAGE_NAME):$(BUILD_VERSION)_beta tag..."
@docker push cjlapao/$(DOCKER_PACKAGE_NAME):$(BUILD_VERSION)_beta
@echo "Pushing cjlapao/$(DOCKER_PACKAGE_NAME):unstable tag..."
@docker push cjlapao/$(DOCKER_PACKAGE_NAME):unstable
@echo "Build finished. Pushed to cjlapao/$(DOCKER_PACKAGE_NAME):$(BUILD_VERSION)_beta and cjlapao/$(DOCKER_PACKAGE_NAME):unstable."

.PHONY: clean
clean:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.11
0.9.12
15 changes: 15 additions & 0 deletions docs/_posts/2024-11-13-v0.9.12.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
layout: post
title: "Release 0.9.12"
date: 2024-11-13 00:00:00 +0000
categories: release notes
---

# Whats New

- Fix timeout for the apis and set the default to 5 hours
- Added more information to the orchestrator hosts endpoint
- Added a fix for the push copy file
- Added a fix in the uninstall of the root service to also clear the database file


Loading

0 comments on commit bd7f397

Please sign in to comment.