Add a way to permanently pin environments
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
An environment is initially configured to auto-stop, but was manually overridden to pin the environment (so it should not auto-stop any more.)
However, if a new pipeline runs and deploys to the environment, the override is removed and the environment will once again be auto stopped in the configured amount of time.
Users want a way to "permanently pin" pin the environment to override the auto-stop feature.
Steps to reproduce
-
Create a new empty project.
-
Add this
.gitlab-ci.yml
and commit it to the repo.deploy_staging: script: - echo "Deploy to staging server" environment: name: "dev/$CI_COMMIT_REF_SLUG" url: "https://$CI_COMMIT_REF_SLUG.example.gitlab.com" auto_stop_in: 3 minutes on_stop: stop_staging_app stop_staging_app: script: - echo "Stopping staging app" environment: name: "dev/$CI_COMMIT_REF_SLUG" action: stop when: manual
-
A new environment will be created. Go to
Deployments
->Environments
on the sidebar to find it. You should see that it will be auto-stopped in the next 3 minutes. -
Pin the environment to prevent it from being auto-stopped.
-
Make a new commit on the same branch. (For example, add a new file called
emptyfile
to the branch.) -
Go back to
Deployments
->Environments
on the sidebar. -
Observe that the environment will be auto-stopped in 3 minutes again.
What is the current bug behavior?
A pinned override is removed when a new deployment is made to the environment.
What is the expected correct behavior?
A pinned environment should remain pinned after a new deployment is made to the environment.
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
``` $ sudo gitlab-rake gitlab:env:info System information System: Ubuntu 20.04 Proxy: no Current User: git Using RVM: no Ruby Version: 2.7.5p203 Gem Version: 3.1.6 Bundler Version:2.3.15 Rake Version: 13.0.6 Redis Version: 6.2.7 Sidekiq Version:6.4.0 Go Version: unknown GitLab information Version: 15.3.3-ee Revision: 1615d086ad8 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 12.10 URL: https://kennethtest-30aao.sr.gitlab.support HTTP Clone URL: https://kennethtest-30aao.sr.gitlab.support/some-group/some-project.git SSH Clone URL: git@kennethtest-30aao.sr.gitlab.support:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: no Using Omniauth: yes Omniauth Providers: GitLab Shell Version: 14.10.0 Repository storage paths: - default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell ```
Results of GitLab application Check
Expand for output related to the GitLab application check
# sudo gitlab-rake gitlab:check SANITIZE=true` Checking GitLab subtasks ... Checking GitLab Shell ... GitLab Shell: ... GitLab Shell version >= 14.10.0 ? ... OK (14.10.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful Checking GitLab Shell ... Finished Checking Gitaly ... Gitaly: ... default ... OK Checking Gitaly ... Finished Checking Sidekiq ... Sidekiq: ... Running? ... yes Number of Sidekiq processes (cluster/worker) ... 1/1 Checking Sidekiq ... Finished Checking Incoming Email ... Incoming Email: ... Reply by email is disabled in config/gitlab.yml Checking Incoming Email ... Finished Checking LDAP ... LDAP: ... LDAP is disabled in config/gitlab.yml Checking LDAP ... Finished Checking GitLab App ... Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Systemd unit files or init script exist? ... skipped (omnibus-gitlab has neither init script nor systemd units) Systemd unit files or init script up-to-date? ... skipped (omnibus-gitlab has neither init script nor systemd units) Projects have namespace: ... GitLab Instance / Monitoring ... yes Administrator / environment_test ... yes Administrator / environment_test2 ... yes Redis version >= 6.0.0? ... yes Ruby version >= 2.7.2 ? ... yes (2.7.5) Git user has default SSH configuration? ... yes Active users: ... 15 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes Elasticsearch version 7.x-8.x or OpenSearch version 1.x ... skipped (Advanced Search is disabled) Checking GitLab App ... Finished Checking GitLab subtasks ... Finished
Workarounds
- Manually pin the environment after every deployment