Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OpenTofu
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
components
OpenTofu
Commits
891f6ed9
Unverified
Commit
891f6ed9
authored
10 months ago
by
Timo Furrer
Browse files
Options
Downloads
Patches
Plain Diff
test
parent
489d46e9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+19
-57
19 additions, 57 deletions
.gitlab-ci.yml
with
19 additions
and
57 deletions
.gitlab-ci.yml
+
19
−
57
View file @
891f6ed9
...
@@ -175,77 +175,39 @@ shellcheck:
...
@@ -175,77 +175,39 @@ shellcheck:
# - if: $CI_COMMIT_TAG
# - if: $CI_COMMIT_TAG
# - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
# - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
gitlab-opentofu-image:deploy:with-opentofu-version
:
gitlab-opentofu-image:deploy
:
extends
:
.opentofu-versions
stage
:
deploy
stage
:
deploy
image
:
image
:
name
:
gcr.io/go-containerregistry/crane:debug
name
:
gcr.io/go-containerregistry/crane:debug
entrypoint
:
[
"
"
]
entrypoint
:
[
"
"
]
variables
:
before_script
:
RELEASE_IMAGE_NAME
:
"
$CI_REGISTRY_IMAGE/gitlab-opentofu"
-
crane auth login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
script
:
# OCI image tags are not compatible with semver, specifically the build metadata part
# OCI image tags are not compatible with semver, specifically the build metadata part
# indicated with a `+` sign, see https://github.com/distribution/distribution/issues/1201
# indicated with a `+` sign, see https://github.com/distribution/distribution/issues/1201
# We use a dash `-` here, instead of the `+`.
# We use a dash `-` here, instead of the `+`.
# This may be problematic, because it indicates a semver prerelease.
# This may be problematic, because it indicates a semver prerelease.
RELEASE_SEMVER
:
"
${CI_COMMIT_TAG}-opentofu${OPENTOFU_VERSION}"
-
export RELEASE_IMAGE_NAME="$CI_REGISTRY_IMAGE/gitlab-opentofu"
RELEASE_IMAGE
:
"
$RELEASE_IMAGE_NAME:$RELEASE_SEMVER"
-
export RELEASE_IMAGE="${RELEASE_IMAGE_NAME}:${RELEASE_VERSION}${RELEASE_OPENTOFU_VERSION:+-opentofu$RELEASE_OPENTOFU_VERSION}"
before_script
:
-
echo "Deploying $GITLAB_OPENTOFU_IMAGE_NAME as $RELEASE_IMAGE"
-
crane auth login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
# - crane copy "$GITLAB_OPENTOFU_IMAGE_NAME" "$RELEASE_IMAGE"
script
:
-
crane copy "$GITLAB_OPENTOFU_IMAGE_NAME" "$RELEASE_IMAGE"
-
'
echo
"-
\`$RELEASE_IMAGE\`
(digest:
\`$(crane
digest
$RELEASE_IMAGE)\`)"
>
image$CI_JOB_ID.md'
-
'
echo
"-
\`$RELEASE_IMAGE\`
(digest:
\`$(crane
digest
$RELEASE_IMAGE)\`)"
>
image$CI_JOB_ID.md'
artifacts
:
artifacts
:
paths
:
paths
:
-
'
image*.md'
-
'
image*.md'
rules
:
-
if
:
$CI_COMMIT_TAG
gitlab-opentofu-image:deploy:latest-with-opentofu-version
:
extends
:
.opentofu-versions
stage
:
deploy
image
:
name
:
gcr.io/go-containerregistry/crane:debug
entrypoint
:
[
"
"
]
variables
:
RELEASE_IMAGE_NAME
:
"
$CI_REGISTRY_IMAGE/gitlab-opentofu"
RELEASE_SEMVER
:
"
latest-opentofu${OPENTOFU_VERSION}"
RELEASE_IMAGE
:
"
$RELEASE_IMAGE_NAME:$RELEASE_SEMVER"
before_script
:
-
crane auth login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
script
:
-
crane copy "$GITLAB_OPENTOFU_IMAGE_NAME" "$RELEASE_IMAGE"
-
'
echo
"-
\`$RELEASE_IMAGE\`
(digest:
\`$(crane
digest
$RELEASE_IMAGE)\`)"
>
image$CI_JOB_ID.md'
artifacts
:
paths
:
-
'
image*.md'
rules
:
-
if
:
$CI_COMMIT_TAG
gitlab-opentofu-image:deploy:latest
:
stage
:
deploy
image
:
name
:
gcr.io/go-containerregistry/crane:debug
entrypoint
:
[
"
"
]
variables
:
OPENTOFU_VERSION
:
$LATEST_OPENTOFU_VERSION
RELEASE_IMAGE_NAME
:
"
$CI_REGISTRY_IMAGE/gitlab-opentofu"
RELEASE_IMAGE
:
"
$RELEASE_IMAGE_NAME:$RELEASE_IMAGE_TAG"
before_script
:
-
crane auth login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
script
:
-
crane copy "$GITLAB_OPENTOFU_IMAGE_NAME" "$RELEASE_IMAGE"
-
'
echo
"-
\`$RELEASE_IMAGE\`
(digest:
\`$(crane
digest
$RELEASE_IMAGE)\`)"
>
image$CI_JOB_ID.md'
artifacts
:
paths
:
-
'
image*.md'
rules
:
-
if
:
$CI_COMMIT_TAG
parallel
:
parallel
:
matrix
:
matrix
:
-
RELEASE_IMAGE_TAG
:
${CI_COMMIT_TAG}
-
OPENTOFU_VERSION
:
!reference
[
.data
,
supported_versions
]
-
RELEASE_IMAGE_TAG
:
${CI_COMMIT_TAG}-opentofulatest
RELEASE_VERSION
:
$CI_COMMIT_TAG
-
RELEASE_IMAGE_TAG
:
latest-opentofulatest
RELEASE_OPENTOFU_VERSION
:
$OPENTOFU_VERSION
-
RELEASE_IMAGE_TAG
:
latest
-
OPENTOFU_VERSION
:
!reference
[
.data
,
supported_versions
]
RELEASE_VERSION
:
latest
RELEASE_OPENTOFU_VERSION
:
$OPENTOFU_VERSION
-
OPENTOFU_VERSION
:
$LATEST_OPENTOFU_VERSION
RELEASE_VERSION
:
[
"
${CI_COMMIT_TAG}"
,
latest
]
RELEASE_OPENTOFU_VERSION
:
[
"
"
,
latest
]
# rules:
# - if: $CI_COMMIT_TAG
# If the pipeline is for a new tag with a semantic version, and all previous jobs succeed,
# If the pipeline is for a new tag with a semantic version, and all previous jobs succeed,
# create the release.
# create the release.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment