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

[rhcos-4.14] mantle/platform/aliyun: modify the API to use HTTPS by default #3855

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
49 changes: 1 addition & 48 deletions .cci.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,58 +6,11 @@ def cpuCount = 6
def cpuCount_s = cpuCount.toString()
def imageName = buildImage(env: [ENABLE_GO_RACE_DETECTOR: "1", GOMAXPROCS: cpuCount_s], cpu: cpuCount_s)

def memory = (cpuCount * 1536) as Integer
pod(image: imageName + ":latest", kvm: true, cpu: "${cpuCount}", memory: "${memory}Mi") {
pod(image: imageName + ":latest", cpu: "2", memory: "3072Mi") {
checkout scm

stage("Unit tests") {
shwrap("make check")
shwrap("make unittest")
}

shwrap("rpm -qa | sort > rpmdb.txt")
archiveArtifacts artifacts: 'rpmdb.txt'

// Run stage Build FCOS (init, fetch and build)
cosaBuild(skipKola: 1, cosaDir: "/srv", noForce: true)

// Run stage Kola QEMU (basic-qemu-scenarios, upgrade and self tests)
kola(cosaDir: "/srv", addExtTests: ["${env.WORKSPACE}/ci/run-kola-self-tests"])

stage("Build Metal") {
cosaParallelCmds(cosaDir: "/srv", commands: ["metal", "metal4k"])
}

stage("Build Live Images") {
// Explicitly test re-importing the ostree repo
shwrap("cd /srv && rm tmp/repo -rf")
utils.cosaCmd(cosaDir: "/srv", args: "buildextend-live --fast")
}

kolaTestIso(cosaDir: "/srv")

stage("Build Cloud Images") {
cosaParallelCmds(cosaDir: "/srv", commands: ["Aliyun", "AWS", "Azure", "DigitalOcean", "Exoscale", "GCP",
"IBMCloud", "OpenStack", "VMware", "Vultr"])

// quick schema validation
utils.cosaCmd(cosaDir: "/srv", args: "meta --get name")
}

stage("Compress") {
utils.cosaCmd(cosaDir: "/srv", args: "compress --fast")
}

stage("Upload Dry Run") {
utils.cosaCmd(cosaDir: "/srv", args: "buildupload --dry-run s3 --acl=public-read my-nonexistent-bucket/my/prefix")
}

// Random other tests that aren't about building. XXX: These should be part of `make
// check` or something and use dummy cosa builds.
stage("CLI Tests") {
shwrap("""
cd /srv
${env.WORKSPACE}/tests/test_pruning.sh
""")
}
}
2 changes: 1 addition & 1 deletion ci/prow-rhcos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ esac
export COSA_SKIP_OVERLAY=1
# Create a temporary cosa workdir
cd "$(mktemp -d)"
cosa init --variant scos --transient -b "${RHCOS_BRANCH}" https://github.com/openshift/os
cosa init --transient -b "${RHCOS_BRANCH}" https://github.com/openshift/os
# Use a COSA specifc test entry point to focus on tests relevant for COSA
exec src/config/ci/prow-entrypoint.sh rhcos-cosa-prow-pr-ci
14 changes: 6 additions & 8 deletions mantle/platform/api/aliyun/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import (
"github.com/coreos/pkg/capnslog"
"github.com/coreos/pkg/multierror"

"github.com/aliyun/alibaba-cloud-sdk-go/sdk"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
"github.com/aliyun/aliyun-oss-go-sdk/oss"
Expand Down Expand Up @@ -88,7 +90,10 @@ func New(opts *Options) (*API, error) {
opts.Region = profile.Region
}

ecs, err := ecs.NewClientWithAccessKey(opts.Region, opts.AccessKeyID, opts.SecretKey)
config := sdk.NewConfig()
config.Scheme = "HTTPS"
credential := credentials.NewAccessKeyCredential(opts.AccessKeyID, opts.SecretKey)
ecs, err := ecs.NewClientWithOptions(opts.Region, config, credential)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -207,7 +212,6 @@ func (a *API) ImportImage(format, bucket, object, image_size, device, name, desc
request := ecs.CreateImportImageRequest()
request.SetConnectTimeout(defaultConnectTimeout)
request.SetReadTimeout(defaultReadTimeout)
request.Scheme = "https"
request.DiskDeviceMapping = &[]ecs.ImportImageDiskDeviceMapping{
{
Format: format,
Expand Down Expand Up @@ -297,7 +301,6 @@ func (a *API) GetImages(name string) (*ecs.DescribeImagesResponse, error) {
request := ecs.CreateDescribeImagesRequest()
request.SetConnectTimeout(defaultConnectTimeout)
request.SetReadTimeout(defaultReadTimeout)
request.Scheme = "https"
request.ImageName = name
return a.ecs.DescribeImages(request)
}
Expand All @@ -307,7 +310,6 @@ func (a *API) GetImagesByID(id string, region string) (*ecs.DescribeImagesRespon
request := ecs.CreateDescribeImagesRequest()
request.SetConnectTimeout(defaultConnectTimeout)
request.SetReadTimeout(defaultReadTimeout)
request.Scheme = "https"
request.ImageId = id
request.RegionId = region
return a.ecs.DescribeImages(request)
Expand All @@ -318,7 +320,6 @@ func (a *API) DeleteImage(id string, force bool) error {
request := ecs.CreateDeleteImageRequest()
request.SetConnectTimeout(defaultConnectTimeout)
request.SetReadTimeout(defaultReadTimeout)
request.Scheme = "https"
request.ImageId = id
request.Force = requests.NewBoolean(force)

Expand Down Expand Up @@ -350,7 +351,6 @@ func (a *API) DeleteSnapshot(id string, force bool) error {
request := ecs.CreateDeleteSnapshotRequest()
request.SetConnectTimeout(defaultConnectTimeout)
request.SetReadTimeout(defaultReadTimeout)
request.Scheme = "https"
request.SnapshotId = id
request.Force = requests.NewBoolean(force)
_, err := a.ecs.DeleteSnapshot(request)
Expand Down Expand Up @@ -430,7 +430,6 @@ func (a *API) ListRegions() ([]string, error) {
request := ecs.CreateDescribeRegionsRequest()
request.SetConnectTimeout(defaultConnectTimeout)
request.SetReadTimeout(defaultReadTimeout)
request.Scheme = "https"

response, err := a.ecs.DescribeRegions(request)
if err != nil {
Expand Down Expand Up @@ -468,7 +467,6 @@ func (a *API) ChangeVisibility(region string, id string, public bool) error {
request := ecs.CreateModifyImageSharePermissionRequest()
request.SetConnectTimeout(defaultConnectTimeout)
request.SetReadTimeout(defaultReadTimeout)
request.Scheme = "https"
request.ImageId = id
request.RegionId = region
request.IsPublic = requests.NewBoolean(public)
Expand Down
Loading