Skip to content
Merged
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: 5 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: golang-1.24.11
uses: actions/setup-go@v3
- name: golang
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: version
run: echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
- name: secrets
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: golang-1.24.11
uses: actions/setup-go@v3
- name: golang
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: go path
run: |
mkdir -p ${HOME}/go
Expand All @@ -29,11 +31,11 @@ jobs:
changelog="${changelog//'%'/'%25'}"
changelog="${changelog//$'\n'/'%0A'}"
changelog="${changelog//$'\r'/'%0D'}"
echo "::set-output name=text::${changelog}"
echo "text=${changelog}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: login
run: docker login --username "${DOCKER_USERNAME}" --password "${DOCKER_PASSWORD}"
env:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ENV DOCKER_BUILDKIT=1
RUN curl -s https://download.docker.com/linux/static/stable/${DOCKER_ARCH}/docker-18.09.9.tgz | \
tar -C /usr/bin --strip-components 1 -xz

RUN curl -Ls https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/linux/${KUBECTL_ARCH}/kubectl -o /usr/bin/kubectl && \
RUN curl -Ls https://storage.googleapis.com/kubernetes-release/release/v1.28.15/bin/linux/${KUBECTL_ARCH}/kubectl -o /usr/bin/kubectl && \
chmod +x /usr/bin/kubectl

ENV DEVELOPMENT=false
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.arm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN apt-get -qq update && apt-get -qq -y install curl
RUN curl -s https://download.docker.com/linux/static/stable/${DOCKER_ARCH}/docker-18.03.1-ce.tgz | \
tar -C /usr/bin --strip-components 1 -xz

RUN curl -Ls https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/linux/${KUBECTL_ARCH}/kubectl -o /usr/bin/kubectl && \
RUN curl -Ls https://storage.googleapis.com/kubernetes-release/release/v1.28.15/bin/linux/${KUBECTL_ARCH}/kubectl -o /usr/bin/kubectl && \
chmod +x /usr/bin/kubectl

ENV DEVELOPMENT=false
Expand Down
8 changes: 8 additions & 0 deletions ci/additonal-test/apps-resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,11 @@ convox exec -a ci2 $ps -- env | grep "MARIADB_PASS"
convox exec -a ci2 $ps -- env | grep "MARIADB_HOST"
convox exec -a ci2 $ps -- env | grep "MARIADB_PORT"
convox exec -a ci2 $ps -- env | grep "MARIADB_NAME"
# redis resource
convox exec -a ci2 $ps -- env | grep "REDIS_URL"
convox exec -a ci2 $ps -- env | grep "REDIS_HOST"
convox exec -a ci2 $ps -- env | grep "REDIS_PORT"
# memcached resource
convox exec -a ci2 $ps -- env | grep "MEMCACHED_URL"
convox exec -a ci2 $ps -- env | grep "MEMCACHED_HOST"
convox exec -a ci2 $ps -- env | grep "MEMCACHED_PORT"
9 changes: 6 additions & 3 deletions ci/additonal-test/rack-resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

set -ex -o pipefail

declare -a RESOURCES=("s3" "sns" "sqs" "mysql")
# s3, sns, sqs removed — they require AWS::IAM::User creation which is blocked
# by the rack's PowerUserAccess role. These resource types need a redesign
# before they can be re-enabled. See TODO-ci-fixes.md for details.
declare -a RESOURCES=("mysql")

# syslog resource
convox rack resources create syslog Url=tcp://syslog.convox.com --name cilog --wait
Expand All @@ -27,7 +30,7 @@ convox rack resources update pgdb BackupRetentionPeriod=2 --wait
[ "$dburl" == "$(convox rack resources url pgdb)" ]
convox rack resources delete pgdb --wait

# create all 4 resources
# create all resources
for i in "${RESOURCES[@]}"
do
convox rack resources create $i
Expand All @@ -49,7 +52,7 @@ do
done
done

# delete all 4 resources
# delete all resources
for i in "${RESOURCES[@]}"
do
name=$(convox rack resources | grep $i | awk '{print $1}')
Expand Down
2 changes: 1 addition & 1 deletion ci/dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sudo ./aws/install
curl -s https://download.docker.com/linux/static/stable/x86_64/docker-18.09.6.tgz | sudo tar -C /usr/bin --strip-components 1 -xz

# install kubectl
curl -Ls https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/linux/amd64/kubectl -o /tmp/kubectl && \
curl -Ls https://storage.googleapis.com/kubernetes-release/release/v1.28.15/bin/linux/amd64/kubectl -o /tmp/kubectl && \
sudo mv /tmp/kubectl /usr/bin/kubectl && sudo chmod +x /usr/bin/kubectl

# install aws-iam-authenticator
Expand Down
11 changes: 5 additions & 6 deletions ci/downgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ source $(dirname $0)/env.sh

if [ "${ACTION}" == "downgrade" ]; then
convox rack update "${LATEST}" --wait | tee downgrade-log.txt
# temp for whitelisting pr
# if grep -Fq "_FAILED" downgrade-log.txt; then
# exit 1;
# else
# echo ok;
# fi
if grep -Fq "_FAILED" downgrade-log.txt; then
exit 1;
else
echo ok;
fi

version=$(convox rack | grep Version | awk -F ' +' '{print $2}')
if [ "${version}" != "${LATEST}" ]; then
Expand Down
4 changes: 4 additions & 0 deletions examples/full-convox-yaml/convox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ resources:
version: 10.6
memcached:
type: memcached
options:
class: cache.t3.micro
redis:
type: redis
options:
class: cache.t3.micro
sharedvolume:
type: efs
options:
Expand Down
4 changes: 0 additions & 4 deletions provider/aws/builds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,8 @@ func TestBuildExport(t *testing.T) {
defer provider.Close()

d := stubDocker(
cycleBuildDockerPing,
cycleBuildDockerInfo,
cycleBuildDockerLogin,
cycleBuildDockerPing,
cycleBuildDockerPull,
cycleBuildDockerPing,
cycleBuildDockerSave,
)
defer d.Close()
Expand Down
28 changes: 27 additions & 1 deletion provider/aws/docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,43 @@ package aws_test

import (
"fmt"
"net/http"
"net/http/httptest"
"os"
"strings"

"github.com/convox/rack/pkg/test/awsutil"
)

func stubDocker(cycles ...awsutil.Cycle) *httptest.Server {
handler := awsutil.NewHandler(cycles)
s := httptest.NewServer(handler)

// Wrap the handler to transparently handle Docker version negotiation
// requests that vary across Docker CLI versions. CI uses Docker 18.09.6
// which sends /_ping and /v1.24/info before API calls, while newer
// versions may skip /info or send different negotiation sequences.
wrapper := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if strings.HasSuffix(r.URL.Path, "/_ping") {
w.Header().Set("Api-Version", "1.24")
w.Header().Set("Docker-Experimental", "false")
w.Header().Set("Ostype", "linux")
w.WriteHeader(200)
w.Write([]byte("OK"))
return
}
if strings.HasSuffix(r.URL.Path, "/info") {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(200)
w.Write([]byte("{}"))
return
}
handler.ServeHTTP(w, r)
})

s := httptest.NewServer(wrapper)

os.Setenv("DOCKER_HOST", fmt.Sprintf("tcp://%s", s.URL[7:]))
os.Setenv("DOCKER_API_VERSION", "1.24")

return s
}
66 changes: 31 additions & 35 deletions provider/aws/formation/g1/app.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -800,18 +800,19 @@
"Properties": {
"Handler": "index.handler",
"Role": { "Fn::GetAtt": [ "CronRole", "Arn" ] },
"Runtime": "nodejs16.x",
"Runtime": "nodejs22.x",
"Timeout": 50,
"Code": {
"ZipFile": { "Fn::Join": ["\n", [
"'use strict';",
"var aws = require('aws-sdk');",
"var ecs = new aws.ECS({maxRetries:10});",
"var logs = new aws.CloudWatchLogs();",
"var { ECSClient, RunTaskCommand } = require('@aws-sdk/client-ecs');",
"var { CloudWatchLogsClient, CreateLogStreamCommand, PutLogEventsCommand } = require('@aws-sdk/client-cloudwatch-logs');",
"var ecs = new ECSClient({maxAttempts:11});",
"var logs = new CloudWatchLogsClient({});",
"var cluster = '{{ $.Cluster }}';",
{ "Fn::Join": [ "", [ "var logGroup = '", { "Ref": "LogGroup" }, "';" ] ] },
{ "Fn::Join": [ "", [ "var release = '", { "Ref": "Release" }, "';" ] ] },
"exports.handler = function(event, context, cb) {",
"exports.handler = async function(event, context) {",
" var command = event.command.replace(/&#(\\d+);/g, function(match, dec) {",
" return String.fromCharCode(dec);",
" });",
Expand All @@ -827,45 +828,40 @@
" }",
" };",
" var skew = Math.floor(Math.random()*10000);",
" setTimeout(function() {",
" ecs.runTask(params, function (err, res) {",
" if (err) return cb(err);",
" var message = 'skew=' + skew + 'ms command=' + event.command;",
" if (res.failures.length) {",
" message += ' result=failure reason=' + res.failures[0].reason;",
" log(event, 'error', message, function(err) {",
" console.log('err2', err);",
" cb();",
" });",
" } else {",
" message += ' result=success task=' + res.tasks[0].taskArn;",
" log(event, res.tasks[0].taskArn, message, function(err) {",
" console.log('err2', err);",
" cb();",
" });",
" }",
" });",
" }, skew);",
" await new Promise(function(r) { setTimeout(r, skew); });",
" var res = await ecs.send(new RunTaskCommand(params));",
" var message = 'skew=' + skew + 'ms command=' + event.command;",
" if (res.failures.length) {",
" message += ' result=failure reason=' + res.failures[0].reason;",
" await log(event, 'error', message);",
" } else {",
" message += ' result=success task=' + res.tasks[0].taskArn;",
" await log(event, res.tasks[0].taskArn, message);",
" }",
"};",
"function log(event, task, message, cb) {",
"async function log(event, task, message) {",
" var id = task.split('-').pop();",
" var stream = 'cron/' + event.process + '/' + id;",
" var params = {",
" logGroupName: logGroup,",
" logStreamName: stream",
" }",
" logs.createLogStream(params, function(err) {",
" try {",
" await logs.send(new CreateLogStreamCommand({",
" logGroupName: logGroup,",
" logStreamName: stream",
" }));",
" } catch(err) {",
" console.log('err', err);",
" var params = {",
" }",
" console.log(message);",
" try {",
" await logs.send(new PutLogEventsCommand({",
" logEvents: [",
" { message: message, timestamp: (new Date()).getTime() }",
" ],",
" logGroupName: logGroup,",
" logStreamName: stream",
" }",
" console.log(message);",
" logs.putLogEvents(params, cb);",
" })",
" }));",
" } catch(err) {",
" console.log('err2', err);",
" }",
"}"
] ] }
}
Expand Down
7 changes: 4 additions & 3 deletions provider/aws/formation/rack.json
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,13 @@
"RegionConfig": {
"af-south-1": { "EFS": "Yes", "ThirdAvailabilityZone": "Yes", "ELBAccountId": "098369216593", "Fargate": "Yes" },
"ap-east-1": { "EFS": "Yes", "ThirdAvailabilityZone": "Yes", "ELBAccountId": "754344448648", "Fargate": "Yes" },
"ap-northeast-1": { "EFS": "Yes", "ThirdAvailabilityZone": "Yes", "ELBAccountId": "582318560864", "Fargate": "No" },
"ap-northeast-1": { "EFS": "Yes", "ThirdAvailabilityZone": "Yes", "ELBAccountId": "582318560864", "Fargate": "Yes" },
"ap-northeast-2": { "EFS": "Yes", "ThirdAvailabilityZone": "Yes", "ELBAccountId": "600734575887", "Fargate": "Yes" },
"ap-northeast-3": { "EFS": "Yes", "ThirdAvailabilityZone": "Yes", "ELBAccountId": "383597477331", "Fargate": "Yes" },
"ap-south-1": { "EFS": "Yes", "ThirdAvailabilityZone": "Yes", "ELBAccountId": "718504428378", "Fargate": "Yes" },
"ap-southeast-1": { "EFS": "Yes", "ThirdAvailabilityZone": "Yes", "ELBAccountId": "114774131450", "Fargate": "Yes" },
"ap-southeast-2": { "EFS": "Yes", "ThirdAvailabilityZone": "Yes", "ELBAccountId": "783225319266", "Fargate": "Yes" },
"ca-central-1": { "EFS": "Yes", "ThirdAvailabilityZone": "Yes", "ELBAccountId": "985666609251", "Fargate": "No" },
"ca-central-1": { "EFS": "Yes", "ThirdAvailabilityZone": "Yes", "ELBAccountId": "985666609251", "Fargate": "Yes" },
"eu-central-1": { "EFS": "Yes", "ThirdAvailabilityZone": "Yes", "ELBAccountId": "054676820928", "Fargate": "Yes" },
"eu-north-1": { "EFS": "Yes", "ThirdAvailabilityZone": "Yes", "ELBAccountId": "897822967062", "Fargate": "Yes" },
"eu-south-1": { "EFS": "Yes", "ThirdAvailabilityZone": "Yes", "ELBAccountId": "635631232127", "Fargate": "Yes" },
Expand All @@ -267,7 +267,7 @@
"sa-east-1": { "EFS": "Yes", "ThirdAvailabilityZone": "Yes", "ELBAccountId": "507241528517", "Fargate": "Yes" },
"us-east-1": { "EFS": "Yes", "ThirdAvailabilityZone": "Yes", "ELBAccountId": "127311923021", "Fargate": "Yes" },
"us-east-2": { "EFS": "Yes", "ThirdAvailabilityZone": "Yes", "ELBAccountId": "033677994240", "Fargate": "Yes" },
"us-west-1": { "EFS": "Yes", "ThirdAvailabilityZone": "No", "ELBAccountId": "027434742980", "Fargate": "No" },
"us-west-1": { "EFS": "Yes", "ThirdAvailabilityZone": "No", "ELBAccountId": "027434742980", "Fargate": "Yes" },
"us-west-2": { "EFS": "Yes", "ThirdAvailabilityZone": "Yes", "ELBAccountId": "797873946194", "Fargate": "Yes" },
"us-gov-east-1": { "EFS": "Yes", "ThirdAvailabilityZone": "Yes", "ELBAccountId": "190560391635", "Fargate": "Yes" },
"us-gov-west-1": { "EFS": "Yes", "ThirdAvailabilityZone": "Yes", "ELBAccountId": "048591011584", "Fargate": "Yes" }
Expand Down Expand Up @@ -1924,6 +1924,7 @@
"UserData": { "Fn::Base64":
{ "Fn::Join": [ "", [
"#cloud-config\n",
"# rack-version: ", { "Ref": "Version" }, "\n",
"repo_upgrade_exclude:\n",
" - kernel*\n",
"packages:\n",
Expand Down
Loading