teleport/dronegen/yum.go
Walt d6f07e4f54
APT/YUM publishing fixes (#17638)
* Serialize apt/yum promote pipelines

These were running in parallel, but we want them to run serially.
Therefore, we add a dependency between each step and its previous step.

* Allow dev build promotes to proceed in deb/rpm pipelines

This helps test a couple more changes from this pipeline when cutting a
dev build.  Particularly, we saw the download and role assumption steps
fail in https://github.com/gravitational/teleport/pull/17334, and this
change would have allowed us to catch that error during testing.

* Fix globbing bug

This bug does not appear to affect anything currently.  However it
should be fixed in case the rm is important at some point in the future.

The bug is: when a wildcard is inside quotes, it is treated as a literal
filename.  So rm -rf "$ARTIFACT_PATH/*" tries to remove the file named
'*' instead of trying to remove everything in artifact path.

* Swap YUM_REPO_NEW_ROLE to YUM_REPO_NEW_AWS_ROLE

All other roles environment variables end in AWS_ROLE, and consistency
is our friend here.
2022-10-21 06:23:21 +00:00

64 lines
1.7 KiB
Go

// Copyright 2021 Gravitational, Inc
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package main
import (
"path"
)
// This function calls the build-apt-repos tool which handles the APT portion of RFD 0058.
func promoteYumPipeline() pipeline {
return getYumPipelineBuilder().buildPromoteOsPackagePipeline()
}
func migrateYumPipeline(triggerBranch string, migrationVersions []string) pipeline {
return getYumPipelineBuilder().buildMigrateOsPackagePipeline(triggerBranch, migrationVersions)
}
func getYumPipelineBuilder() *OsPackageToolPipelineBuilder {
optpb := NewOsPackageToolPipelineBuilder(
"drone-s3-yumrepo-pvc",
"rpm",
"yum",
NewRepoBucketSecrets(
"YUM_REPO_NEW_AWS_S3_BUCKET",
"YUM_REPO_NEW_AWS_ACCESS_KEY_ID",
"YUM_REPO_NEW_AWS_SECRET_ACCESS_KEY",
"YUM_REPO_NEW_AWS_ROLE",
),
)
optpb.environmentVars["CACHE_DIR"] = value{
raw: path.Join(optpb.pvcMountPoint, "createrepo_cache"),
}
optpb.environmentVars["BUCKET_CACHE_PATH"] = value{
raw: path.Join(optpb.pvcMountPoint, "bucket"),
}
optpb.requiredPackages = []string{
"createrepo-c",
}
optpb.setupCommands = []string{
"mkdir -pv \"$CACHE_DIR\"",
}
optpb.extraArgs = []string{
"-cache-dir \"$CACHE_DIR\"",
}
return optpb
}